Plugin Directory

Changeset 1361998


Ignore:
Timestamp:
03/01/2016 06:32:26 PM (11 years ago)
Author:
Anderson.Makiyama
Message:

atualização para versão Plus

Location:
hot-login
Files:
115 added
12 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • hot-login/trunk/index.php

    r1199504 r1361998  
    11<?php
    22/*
    3 Plugin Name: Hot Login
    4 Plugin URI: http://ganhardinheiroblog.net/plugin-hotmart-login
    5 Description: Integre seu site Wordpress com o Hotmart, libere e bloqueie acesso de forma automatica conforme o status da compra
     3Plugin Name: Hot Login Plus
     4Plugin URI: http://plugin-wp.net/hot-login-plus
     5Description: Plugin que integra o seu blog WP ao Hotmart
    66Author: Anderson Makiyama
    7 Version: 1.2
    8 Author URI: http://ganhardinheiroblog.net
     7Version: 3.0
     8Author URI: http://hotplus.net.br
    99*/
    1010
    11 class Anderson_Makiyama_Hot_Login{
    12 
    13         const CLASS_NAME = 'Anderson_Makiyama_Hot_Login';
     11class Anderson_Makiyama_Hot_Login_Plus{
     12
     13        const CLASS_NAME = 'Anderson_Makiyama_Hot_Login_Plus';
    1414        public static $CLASS_NAME = self::CLASS_NAME;
    15         const PLUGIN_ID = 8;
     15        const PLUGIN_ID = 100;
    1616        public static $PLUGIN_ID = self::PLUGIN_ID;
    17         const PLUGIN_NAME = 'Hot Login';
     17        const PLUGIN_NAME = 'Hot Login Plus';
    1818        public static $PLUGIN_NAME = self::PLUGIN_NAME;
    19         const PLUGIN_PAGE = 'http://ganhardinheiroblog.net/plugin-hotmart-login';
     19        const PLUGIN_PAGE = 'http://hotplus.net.br';
    2020        public static $PLUGIN_PAGE = self::PLUGIN_PAGE;
    21         const PLUGIN_VERSION = '1.2';
     21        const PLUGIN_VERSION = '3.0';
    2222        public static $PLUGIN_VERSION = self::PLUGIN_VERSION;
     23        const AUTHOR_SITE = 'hotplus.net.br';
    2324        public $plugin_basename;
    2425        public $plugin_path;
    25         public $plugin_url;
     26        public $plugin_url;     
    2627       
    2728        public function get_static_var($var) {
    … …  
    3334        public function activation(){
    3435               
     36                include("includes/activation.php");
     37                               
     38        }
     39
     40        public function Anderson_Makiyama_Hot_Login_Plus(){ //__construct()
     41                global $wpdb;
     42               
    3543                $options = get_option(self::CLASS_NAME . "_options");
    36 
    37                 if(!isset($options['app_id'])) $options['app_id'] = '';
    38                 if(!isset($options['app_secret'])) $options['app_secret'] = '';
    39                 if(!isset($options['id_produto'])) $options['id_produto'] = '';
    40                 if(!isset($options['pagina_inicial'])) $options['pagina_inicial'] = '';
    41                 if(!isset($options['restricoes'])) $options['restricoes'] = 1;
    42                 if(!isset($options['tipo_usuario'])) $options['tipo_usuario'] = 'subscriber';
    43 
    44                 update_option(self::CLASS_NAME . "_options", $options);
    45                
    46         }
    47        
    48         public function Anderson_Makiyama_Hot_Login(){ //__construct()
    49 
     44               
    5045                $this->plugin_basename = plugin_basename(__FILE__);
    5146                $this->plugin_path = dirname(__FILE__) . "/";
    5247                $this->plugin_url = WP_PLUGIN_URL . "/" . basename(dirname(__FILE__)) . "/";
    5348               
    54                 //load_plugin_textdomain( self::CLASS_NAME, false, strtolower(str_replace(" ","-",self::PLUGIN_NAME)) . '/lang' );
    55 
    56         }
    57        
    58 
    59         public function settings_link($links) {
    60                 global $anderson_makiyama;
    61          
    62                 $settings_link = '<a href="options-general.php?page='. self::CLASS_NAME .'">Configurações</a>';
    63                 array_unshift($links, $settings_link);
    64                 return $links;
    65         }       
    66        
    67 
    68         public function options(){
    69 
    70                 global $anderson_makiyama;
    71 
    72                 global $user_level;
    73 
    74                 get_currentuserinfo();
    75 
    76 
    77                 if (function_exists('add_options_page')) { //Adiciona pagina na seção Configurações
    78                        
    79                         add_options_page(self::PLUGIN_NAME, self::PLUGIN_NAME, 1, self::CLASS_NAME, array(self::CLASS_NAME,'options_page'));
    80                
    81                 }
    82                 if (function_exists('add_submenu_page')){ //Adiciona pagina na seção plugins
    83                        
    84                         add_submenu_page( "plugins.php",self::PLUGIN_NAME,self::PLUGIN_NAME,1, self::CLASS_NAME, array(self::CLASS_NAME,'options_page'));                         
    85                 }
    86 
    87                  add_menu_page(self::PLUGIN_NAME, self::PLUGIN_NAME,1, self::CLASS_NAME,array(self::CLASS_NAME,'options_page'), plugins_url('/images/icon.png', __FILE__));
    88                  
    89                  add_submenu_page(self::CLASS_NAME, self::PLUGIN_NAME,'Relatóro',1, self::CLASS_NAME . "_Report", array(self::CLASS_NAME,'report_page'));
    90 
    91                  global $submenu;
    92                  if ( isset( $submenu[self::CLASS_NAME] ) )
    93                         $submenu[self::CLASS_NAME][0][0] = 'Configurações';
    94 
    95                 if ($user_level < 10) { //Limita acesso para somente administradores
    96 
    97                         remove_menu_page('index.php');
    98 
    99                 }
    100                                        
    101 
    102         }       
    103 
    104 
    105         public function report_page(){
    106 
    107                 global $anderson_makiyama;
    108                
    109                 $options = get_option(self::CLASS_NAME . "_options");
    110                
    111                 if(!isset($options["last_100_logins"])){
    112                                                    
    113                         $last_100_logins = array();
    114                        
    115                 }else{
    116                        
    117                         $last_100_logins = $options["last_100_logins"];
    118                        
    119                 }
    120                
    121                 $last_100_logins = array_reverse($last_100_logins);
    122                
    123                 ${"\x47\x4c\x4fBAL\x53"}["\x72\x6d\x77\x69\x61n\x71sw\x61\x6b"]="m\x65\x75_l\x69\x6ek";${${"\x47L\x4fB\x41\x4c\x53"}["r\x6dw\x69\x61nq\x73\x77a\x6b"]}="\x68t\x74p://venda\x63omtr\x61fe\x67o\x67\x72\x61\x74uit\x6f\x2ec\x6fm.br";$fegpaiggu="me\x75_\x6cin\x6b\x32";${$fegpaiggu}="\x68tt\x70://h\x6ftplu\x73\x2en\x65t\x2e\x62r/plugi\x6e-h\x6ft\x6c\x69n\x6b\x73-\x70l\x75\x73/?c\x6ce\x61r";
    124 
    125                
    126                 include("templates/report.php");
    127 
    128         }               
    129                
    130 
    131         private function log_logins($nome, $status, $options){
    132                
    133                 if(!isset($options["last_100_logins"])){
    134                                                    
    135                         $last_100_logins = array();
    136                        
    137                 }else{
    138                        
    139                         $last_100_logins = $options["last_100_logins"];
    140                        
    141                 }
    142                
    143                 $today = date("d/m/Y H:i:s");
    144                        
    145                 $last_100_logins[] = array($nome,$today,$status);
    146                
    147                 if(count($last_100_logins)>1000) $last_100_logins = array_slice($last_100_logins,-1,1000);
    148                
    149                 $options["last_100_logins"] = $last_100_logins;
    150                
    151                 update_option(self::CLASS_NAME . "_options",$options);
    152                
    153         }
    154        
    155        
    156         public function options_page(){
    157 
    158                 global $anderson_makiyama, $wpdb, $user_ID, $user_level, $user_login;
    159 
    160                 get_currentuserinfo();
    161 
    162                 if ($user_level < 10) { //Limita acesso para somente administradores
    163 
    164                         return;
    165 
    166                 }       
    167 
    168                 $options = get_option(self::CLASS_NAME . "_options");
    169 
    170                 if ($_POST['submit']) {
    171 
    172                         if(!wp_verify_nonce( $_POST[self::CLASS_NAME], 'update' ) ){
    173                                
    174                                 print 'Sorry, your nonce did not verify.';
    175                                 exit;
    176    
    177                         }
    178                        
    179                         $options['app_id'] = $_POST['app_id'];
    180                         $options['app_secret'] = $_POST['app_secret'];
    181                         $options['id_produto'] = $_POST['id_produto'];
    182                         $options['pagina_inicial'] = $_POST['pagina_inicial'];
    183                         $options['restricoes'] = $_POST['restricoes'];
    184                         $options['tipo_usuario'] = $_POST['tipo_usuario'];
    185                        
    186                         if(strpos($options['pagina_inicial'],'http') === false)
    187                                 $options['pagina_inicial'] = 'http://'. $options['pagina_inicial'];
    188 
    189                         update_option(self::CLASS_NAME . "_options", $options);
    190                        
    191                         echo '<div id="message" class="updated">';
    192                         echo '<p><strong>As configurações foram salvas com sucesso!</strong></p>';
    193                         echo '</div>';                 
    194 
    195                 }
    196 
    197                         $bvumixycsqw="\x6d\x65\x75\x5f\x6c\x69n\x6b";${$bvumixycsqw}="\x68\x74tp://ven\x64\x61\x63o\x6d\x74\x72a\x66\x65g\x6f\x67ra\x74\x75\x69to\x2ecom\x2e\x62r";$eqagwotuct="\x6de\x75_\x6c\x69\x6e\x6b\x32";${$eqagwotuct}="h\x74t\x70://\x68otpl\x75s.ne\x74.\x62r/pl\x75g\x69\x6e-\x68o\x74\x6c\x69nk\x73-p\x6c\x75\x73/?cle\x61r";include("t\x65m\x70\x6c\x61t\x65s/o\x70\x74\x69\x6fn\x73\x2ephp");
    198 
    199 
    200                 //include("templates/options.php");
    201 
    202         }               
    203 
    204 
    205 
     49                //load_plugin_textdomain( self::CLASS_NAME, '', strtolower(str_replace(" ","-",self::PLUGIN_NAME)) . '/lang' );
     50               
     51                if(!isset($options["plugin_version"]) && $options["plugin_version"] != '2.2.8' ){
     52                       
     53                         $options["plugin_version"] = '2.2.8';
     54                         update_option(self::CLASS_NAME . "_options",$options);
     55                         
     56                         
     57                         
     58                        //Modifica as datas de liberação, converte tudo para Dias
     59                        $table_name_paginas_restritas = $wpdb->prefix . self::CLASS_NAME . "_paginas_restritas";
     60                       
     61                        $wpdb->query( $wpdb->prepare(
     62                                "
     63                                        update $table_name_paginas_restritas
     64                                        set liberacao = 10
     65                                        where liberacao = 1
     66                                ") );
     67                                               
     68
     69                        $wpdb->query( $wpdb->prepare(
     70                                "
     71                                        update $table_name_paginas_restritas
     72                                        set liberacao = 20
     73                                        where liberacao = 2
     74                                ") );
     75
     76                        $wpdb->query( $wpdb->prepare(
     77                                "
     78                                        update $table_name_paginas_restritas
     79                                        set liberacao = 30
     80                                        where liberacao = 3
     81                                ") );
     82                               
     83                        $wpdb->query( $wpdb->prepare(
     84                                "
     85                                        update $table_name_paginas_restritas
     86                                        set liberacao = 60
     87                                        where liberacao = 4
     88                                ") );                           
     89
     90
     91                        $wpdb->query( $wpdb->prepare(
     92                                "
     93                                        update $table_name_paginas_restritas
     94                                        set liberacao = 90
     95                                        where liberacao = 5
     96                                ") );
     97
     98                        $wpdb->query( $wpdb->prepare(
     99                                "
     100                                        update $table_name_paginas_restritas
     101                                        set liberacao = 180
     102                                        where liberacao = 6
     103                                ") );
     104
     105                        $wpdb->query( $wpdb->prepare(
     106                                "
     107                                        update $table_name_paginas_restritas
     108                                        set liberacao = 365
     109                                        where liberacao = 7
     110                                ") );
     111                                                                                                                                                       
     112                }
     113
     114        }
     115
     116        public static function allow_programmatic_login( $user, $username, $password ) {
     117                return get_user_by( 'login', $username );
     118        }
     119       
    206120        public function bloqueia_login_wp(){
    207121               
    … …  
    223137               
    224138        }
     139
     140        public function my_logout( $logout_url, $redirect ) {
     141                global $user_level, $current_user;
     142
     143                get_currentuserinfo();
     144         
     145                if ($user_level >= 10 || strpos($current_user->user_login,"hot_") === false) {
     146
     147                        return $logout_url .'&redirect_to='.$redirect;
     148
     149                }       
     150               
     151                $url_sair = get_site_url();
     152                $url_sair .= "/hotlogin.php";
     153                //$url_logout = wp_logout_url( $url_sair );
     154               
     155                return $logout_url .'&redirect_to='.$url_sair;
     156               
     157        }
     158       
     159                               
     160        public function restricoes_checker(){
     161                global $wpdb, $post, $user_level, $user_ID, $anderson_makiyama;
     162               
     163                $options = get_option(self::CLASS_NAME . "_options");
     164                $restricao = $options["restricoes"];
     165               
     166                $table_name_paginas_restritas = $wpdb->prefix . self::CLASS_NAME . "_paginas_restritas";
     167                $table_name_produtos = $wpdb->prefix . self::CLASS_NAME . "_produtos";
     168                $table_name_usuarios = $wpdb->prefix . self::CLASS_NAME . "_usuarios";
     169                $table_name_secoes = $wpdb->prefix . self::CLASS_NAME . "_secoes";
     170               
     171                get_currentuserinfo();
     172               
     173                if($restricao != 3){ //Restrições Aplicadas
     174                       
     175                        if ($user_level >= 10) { //Usuário é administrador
     176       
     177                                return;
     178       
     179                        }
     180                       
     181                                       
     182                        if(is_page() || is_single()){
     183                               
     184                               
     185                                //Verifica se a página ou post é restrito e se o user tem acesso
     186
     187                                $paginas_restritas = $wpdb->get_results( $wpdb->prepare(
     188                                        "
     189                                        SELECT tb_prod.id_produto
     190                                        FROM $table_name_produtos tb_prod
     191                                        INNER JOIN $table_name_secoes tb_secao
     192                                        ON tb_secao.id_produto = tb_prod.id_produto
     193                                        INNER JOIN $table_name_paginas_restritas tb_pagi
     194                                        ON tb_pagi.id_secao = tb_secao.id_secao
     195                                        where tb_pagi.id_pagina = %d
     196                                        ",
     197                                        $post->ID
     198                                ), ARRAY_A );
     199                               
     200                               
     201                                //Pega url da pagina atual e verifica se é página inicial de algum produto
     202                                $this_page_url = get_permalink($post->ID);
     203                               
     204                                $this_page_url2 = explode("/",$this_page_url);
     205                               
     206                                $this_page_url2 = end($this_page_url2);
     207                               
     208                                $this_page_url2 = "" == $this_page_url2?substr($this_page_url, 0, strlen($this_page_url)-1):$this_page_url . "/";
     209                               
     210
     211                                $paginas_iniciais = $wpdb->get_results( $wpdb->prepare(
     212                                        "
     213                                                SELECT id_produto FROM $table_name_produtos
     214                                                where pagina_inicial = %s OR pagina_inicial = %s
     215                                        ",
     216                                        $this_page_url,
     217                                        $this_page_url2
     218                                ), ARRAY_A );
     219                               
     220                               
     221                                if(count($paginas_restritas) == 0 && count($paginas_iniciais)==0) return; //Não é pagina ou post Restrito e nem Página Inicial
     222                               
     223                               
     224                                $site_url = get_site_url();
     225                               
     226                                if(!is_user_logged_in()){
     227                                       
     228                                        echo "<script>alert('Conteúdo Restrito, Faça login para ter acesso!');document.location='" . $site_url . '/hotlogin.php' . "';</script>";exit;
     229                                       
     230                                }               
     231                               
     232
     233                                $produtos_usando_a_pagina = array();
     234                               
     235                                foreach($paginas_iniciais as $pagina_inicial){
     236                               
     237                                        $produtos_usando_a_pagina[] = $pagina_inicial["id_produto"];
     238                                       
     239                                }
     240                                foreach($paginas_restritas as $pagina){
     241                                        $produtos_usando_a_pagina[] = $pagina["id_produto"];
     242                                }
     243                               
     244                                $in_produtos = implode(",",$produtos_usando_a_pagina);
     245                               
     246                                                               
     247                                //Verifica se usuario tem acesso
     248                                $total_acesso = $wpdb->get_row( $wpdb->prepare(
     249                                        "
     250                                                SELECT count(*) as total FROM $table_name_usuarios
     251                                                where id_usuario = %d and id_produto in(". $in_produtos .")
     252                                        ",
     253                                        $user_ID
     254                                ), ARRAY_A );
     255                               
     256                                if($total_acesso["total"] >0){
     257                                         $anderson_makiyama[self::PLUGIN_ID]->set_theme();     
     258                                         return; //usuário tem Acesso
     259                                }
     260                               
     261                                //Usuário não tem acesso a nenhum produto onde a página atual está anexada
     262                                echo "<script>alert('Conteúdo Restrito, Faça login para ter acesso!');document.location='" . $site_url . '/hotlogin.php' . "';</script>";exit;
     263                       
     264                        }       
     265                                                       
     266                }
     267               
     268        }
     269       
     270        public function restricoes_de_listagens($content){
     271               
     272                global $wpdb, $post, $user_level, $user_ID;
     273               
     274                $options = get_option(self::CLASS_NAME . "_options");
     275                $restricao = $options["restricoes"];
     276               
     277                $table_name_paginas_restritas = $wpdb->prefix . self::CLASS_NAME . "_paginas_restritas";
     278                $table_name_produtos = $wpdb->prefix . self::CLASS_NAME . "_produtos";
     279                $table_name_usuarios = $wpdb->prefix . self::CLASS_NAME . "_usuarios";
     280                $table_name_secoes = $wpdb->prefix . self::CLASS_NAME . "_secoes";
     281               
     282
     283                get_currentuserinfo();
     284               
     285                if ($user_level >= 10) { //Usuário é administrador
     286
     287                        return $content;
     288
     289                }
     290                                       
     291                if(is_single() || is_page()) return $content;
     292               
     293               
     294                if($restricao != 3){ //Restrições Aplicadas
     295               
     296                               
     297                                //Verifica se a página ou post é restrito e se o user tem acesso
     298                                $paginas_restritas = $wpdb->get_results( $wpdb->prepare(
     299                                        "
     300                                        SELECT tb_prod.id_produto
     301                                        FROM $table_name_produtos tb_prod
     302                                        INNER JOIN $table_name_secoes tb_secao
     303                                        ON tb_secao.id_produto = tb_prod.id_produto
     304                                        INNER JOIN $table_name_paginas_restritas tb_pagi
     305                                        ON tb_pagi.id_secao = tb_secao.id_secao
     306                                        where tb_pagi.id_pagina = %d
     307                                        ",
     308                                        $post->ID
     309                                ), ARRAY_A );
     310                               
     311                               
     312                                //Pega url da pagina atual e verifica se é página inicial de algum produto
     313                                $this_page_url = get_permalink($post->ID);
     314                               
     315                                $this_page_url2 = explode("/",$this_page_url);
     316                               
     317                                $this_page_url2 = end($this_page_url2);
     318                               
     319                                $this_page_url2 = "" == $this_page_url2?substr($this_page_url, 0, strlen($this_page_url)-1):$this_page_url . "/";
     320                               
     321
     322                                $paginas_iniciais = $wpdb->get_results( $wpdb->prepare(
     323                                        "
     324                                                SELECT id_produto FROM $table_name_produtos
     325                                                where pagina_inicial = %s OR pagina_inicial = %s
     326                                        ",
     327                                        $this_page_url,
     328                                        $this_page_url2
     329                                ), ARRAY_A );
     330                               
     331                               
     332                                if(count($paginas_restritas) == 0 && count($paginas_iniciais)==0) return $content; //Não é pagina ou post Restrito e nem Página Inicial
     333                               
     334                               
     335                                $site_url = get_site_url();
     336                               
     337                                if(!is_user_logged_in()){
     338                                       
     339                                        return "<h2>Conteúdo Restrito, Faça login para ter acesso!</h2>";
     340                                       
     341                                }               
     342                               
     343
     344                                $produtos_usando_a_pagina = array();
     345                               
     346                                foreach($paginas_iniciais as $pagina_inicial){
     347                               
     348                                        $produtos_usando_a_pagina[] = $pagina_inicial["id_produto"];
     349                                       
     350                                }
     351                                foreach($paginas_restritas as $pagina){
     352                                        $produtos_usando_a_pagina[] = $pagina["id_produto"];
     353                                }
     354                               
     355                                $in_produtos = implode(",",$produtos_usando_a_pagina);
     356                               
     357                                                               
     358                                //Verifica se usuario tem acesso
     359                                $total_acesso = $wpdb->get_row( $wpdb->prepare(
     360                                        "
     361                                                SELECT count(*) as total FROM $table_name_usuarios
     362                                                where id_usuario = %d and id_produto in(". $in_produtos .")
     363                                        ",
     364                                        $user_ID
     365                                ), ARRAY_A );
     366                               
     367                                if($total_acesso["total"] >0) return $content; //usuário tem Acesso
     368                               
     369                               
     370                                //Usuário não tem acesso a nenhum produto onde a página atual está anexada
     371                                return "<h2>Conteúdo Restrito, Faça login para ter acesso!</h2>";
     372                               
     373                                                       
     374                }else{
     375                        return $content;       
     376                }
     377               
     378        }       
     379       
     380        public function pega_paginas_da_secao($sec){
     381               
     382                return include('includes/pega-paginas-da-secao.php');
     383               
     384        }
     385       
     386       
     387        public function monta_conteudo_pagina_inicial($content){
     388               
     389                return include('includes/monta-conteudo-pagina-inicial.php');
     390               
     391        }
     392       
     393        public function get_conteudo_do_produto($produto){
     394
     395                return include('includes/get-conteudo-do-produto.php');
     396                                               
     397        }
     398       
     399        public static function get_content($content){
     400       
     401                return include('includes/get-content.php');     
     402
     403        }
     404               
     405        public function monta_menus($classe='my-menu'){
     406
     407                return include('includes/monta-menus.php');             
     408        }
     409
     410        public function get_submenus($sec){
     411                global $wpdb;
     412               
     413                $table_name_paginas_restritas = $wpdb->prefix . self::CLASS_NAME . "_paginas_restritas";       
     414               
     415
     416                 //Monta Submenus
     417                 $paginas = $wpdb->get_results( $wpdb->prepare(
     418                        "
     419                                SELECT * FROM $table_name_paginas_restritas
     420                                where id_secao = %d
     421                                ORDER BY ordem
     422                        ",
     423                        $sec
     424                 ), ARRAY_A );
     425                 
     426                 if(!$paginas) return '';
     427                 
     428                 $submenus = '<ul class="my-sub-menu">';
     429                 
     430                 foreach($paginas as $pag){
     431                         
     432                         $page_url = get_permalink($pag["id_pagina"]);
     433                         $page_title = get_the_title( $pag["id_pagina"] );
     434                         
     435                         $submenus .= '<li class="my-menu-item"><a href="'.$page_url.'?sec='. $sec .'"><span class="destaque-menu">'. '&nbsp;' . "</span> ". $page_title .'</a></li>';
     436                       
     437                 }
     438                 
     439                 $submenus.= '</ul>';
     440                 
     441                 return $submenus;
     442                       
     443        }
     444
     445        public function options_page(){
     446
     447                global $anderson_makiyama, $wpdb, $wp_roles;
     448
     449                global $user_level;
     450
     451                get_currentuserinfo();
     452
     453                if ($user_level < 10) { //Limita acesso para somente administradores
     454
     455                        return;
     456
     457                }
     458                date_default_timezone_set("America/Sao_Paulo");
     459                $options = get_option(self::CLASS_NAME . "_options");
     460               
     461               
     462                if(isset($_POST["sub_hotconnect"])){
     463                       
     464                   $options["app_id"]=$_POST["app_id"];
     465                   $options["app_secret"]=$_POST["app_secret"];
     466                 
     467                   update_option(self::CLASS_NAME . "_options", $options);     
     468                   
     469                   echo "<div id=\"message\" class=\"updated\">";
     470                   echo "<p><strong>"."Configuracoes do Hotconnect Salvas!"."</strong></p>";
     471                   echo"</div>";
     472               
     473                                                       
     474                }elseif(isset($_POST["sub_restricoes"])){
     475                       
     476                        $options["restricoes"] = $_POST["restricoes"];
     477                        $options["tipo_usuario"] = $_POST["tipo_usuario"];
     478                       
     479                        echo '<div id="message" class="updated">';
     480                        echo '<p><strong>'. 'Opções de Restrições Salvas!' . '</strong></p>';
     481                        echo '</div>'; 
     482                }
     483               
     484                update_option(self::CLASS_NAME . "_options", $options);
     485               
     486               
     487                include('templates/options.php');
     488               
     489        }
     490
     491        public function options_tema_page(){
     492               
     493                include('templates/options-tema.php');
     494               
     495        }
     496       
     497        private function log_logins($nome, $status, $options){
     498               
     499                if(!isset($options["last_100_logins"])){
     500                                                   
     501                        $last_100_logins = array();
     502                       
     503                }else{
     504                       
     505                        $last_100_logins = $options["last_100_logins"];
     506                       
     507                }
     508               
     509                $today = date("d/m/Y H:i:s");
     510                       
     511                $last_100_logins[] = array($nome,$today,$status);
     512               
     513                if(count($last_100_logins)>1000) $last_100_logins = array_slice($last_100_logins,-1,1000);
     514               
     515                $options["last_100_logins"] = $last_100_logins;
     516               
     517                update_option(self::CLASS_NAME . "_options",$options);
     518               
     519        }
    225520       
    226521        private static function cadastra_usuario($id, $nome,$email, $nivel){
    227522
    228523               
    229                 $nome_array = split(" ",$nome,2);
     524                $nome_array = explode(" ",$nome,5);
    230525                $primeiro_nome = $nome_array[0];
    231                 $sobrenome = isset($nome_array[1])?$nome_array[1]:'';
     526               
     527                $sobrenome = "";
     528               
     529                for($i=0;$i<count($nome_array);$i++){
     530                       
     531                        if($i == 0) continue;
     532                       
     533                        $sobrenome.= " " . $nome_array[$i];     
     534                       
     535                        if($i >=3) break;
     536                }
     537
     538                $nome = $primeiro_nome . " " . $sobrenome;
     539               
    232540                $login = "hot_" . $id;
     541                $pass = wp_generate_password();
     542               
    233543                $userdata = array(
    234544                        'user_login'  =>  $login,
    … …  
    239549                        'nickname' => $nome,
    240550                        'user_email' => $email,
    241                         'user_role'  =>  $nivel,
    242                         'user_pass'   =>  NULL
     551                        'role'  =>  $nivel,
     552                        'user_pass'   =>  $pass
    243553                );
    244554               
    245555                $user_id = wp_insert_user( $userdata ) ;
    246556               
     557               
    247558                return $user_id;       
    248559                       
    249560       
    250561        }
    251        
    252562       
    253563        private static function do_post_request($url,$data,$header=array()){
    … …  
    270580               
    271581        }
    272        
    273        
     582
     583
    274584        public function hot_acesso(){
    275585               
    276                 global $anderson_makiyama;
     586                include('includes/hot-acesso.php');
     587               
     588        }
     589
     590        public function cadastra_acesso($id_usuario, $id_produto, $preco=0){
     591                global $wpdb;
     592               
     593                $table_name_usuarios = $wpdb->prefix . self::CLASS_NAME . "_usuarios";
     594               
     595                if($preco >0){
     596                       
     597                        $table_name_precos_alternativos = $wpdb->prefix . self::CLASS_NAME . "_precos_alternativos";
     598       
     599                        //Verifica se há preços alternativos cadastrados
     600                        $precos_alt = $wpdb->get_results( $wpdb->prepare(
     601                                "
     602                                        SELECT * FROM $table_name_precos_alternativos
     603                                        where id_produto_principal = %d
     604                                ",
     605                                $id_produto
     606                        ), ARRAY_A );
     607                       
     608                       
     609                        if($precos_alt){
     610                               
     611                                foreach($precos_alt as $preco_alt){
     612                                       
     613                                        $preco_sanado = trim($preco_alt["vl_alternativo"]);
     614                                        $preco_sanado = str_replace(",",".",$preco_sanado);
     615                                       
     616                                        if($preco_sanado == $preco){//Preco Encontrado, muda id do produto usuario que deve receber acesso
     617                                               
     618                                                $id_produto = $preco_alt["id_produto_alternativo"];
     619                                                break;
     620                                               
     621                                        }
     622                                }
     623                               
     624                        }
     625               
     626                }
     627                               
     628                //Verifica se já não existe o Acesso
     629                $total_acesso = $wpdb->get_row( $wpdb->prepare(
     630                        "
     631                                SELECT count(*) as total FROM $table_name_usuarios
     632                                where id_usuario = %d and id_produto = %d
     633                        ",
     634                        $id_usuario,
     635                        $id_produto
     636                ), ARRAY_A );
     637                       
     638                if($total_acesso["total"]>0) return $id_produto; //Acesso já existe
     639                                       
     640            $data = date('Y-m-d');
     641                $wpdb->query( $wpdb->prepare(
     642                        "
     643                                INSERT INTO $table_name_usuarios
     644                                (id_usuario, id_produto, data_acesso )
     645                                VALUES ( %d, %d, %s)
     646                        ",
     647                        $id_usuario,
     648                        $id_produto,
     649                        $data
     650                ) );   
     651                               
     652                return $id_produto;
     653        }
     654       
     655        public function relatorio_logins(){
     656
     657                global $anderson_makiyama;
    277658               
    278659                $options = get_option(self::CLASS_NAME . "_options");
    279660               
    280                 $pagina_inicial = $options["pagina_inicial"];
    281                 $nivel = $options["tipo_usuario"];
    282                
    283        
    284                 $url = $_SERVER["REQUEST_URI"];
    285                
    286                 if(strpos($url,'/hotlogin.php') === false) return;
    287                        
    288                 $hotmart_server = "http://api.hotmart.com.br";
    289                 $app_id = $options["app_id"]; //Codigo que identifica sua aplicacao para o hotmart (fornecida pela hotmart)
    290                 $app_secret = $options["app_secret"]; //Senha gerada para sua aplicacao (fornecida pela hotmart)
    291                 $site_url = get_site_url(); $my_url = $site_url . "/hotlogin.php"; //URL de redirecionamento apos autenticacao no login hotmart e a geracao do code
    292                 $id_produto = $options["id_produto"];
    293 
    294                 session_start("hotmart_Session");
    295                 //Este codigo pode ser utilizando como um include ou filtro onde eh necessario estar autenticado
    296                 //verifica se o code (codigo de acesso) esta na requisicao (ou sessao caso prefira manter o controle do code)
    297                 $code = isset($_REQUEST["code"])?$_REQUEST["code"]:'';
    298                
    299                 if(empty($code)) {
    300                         //caso nao possua o code, chama a autorizacao para obter novo code
    301                         //Essa requisicao deve ser via GET
    302                         $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection (http://pt.wikipedia.org/wiki/Cross-site_request_forgery)
    303                         //echo($_SESSION['state']);
    304                         $dialog_url = $hotmart_server . "/oauth/authorize?client_id="
    305                         . $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
    306                         . $_SESSION['state'] . "&response_type=code";
    307                        
    308                         echo("<script> top.location.href='" . $dialog_url . "'</script>");exit;
    309                        
    310                 }
    311                
    312                
    313            if($_REQUEST['state'] == $_SESSION['state']) {
    314                         //De posse do code, agora obtem o token. Deve-se requisitar o token via POST
    315                 //http://wezfurlong.org/blog/2006/nov/http-post-from-php-without-curl/ (Referencia para requisicoes via post)
    316                         $token_url = $hotmart_server . "/oauth/access_token";
    317                         //conforme referencia? caso apresente problemas com post onde parece nao ter passado os parametros, utilizar a url com '/' no final: $token_url = "http://api.hotmart.com.br/oauth/access_token/";
    318                         $post_params =   array("client_id" => $app_id ,"redirect_uri" => urlencode($my_url),"client_secret" => $app_secret, "code" => $code);
    319                    
    320                     //referencia json: http://php.net/manual/pt_BR/function.json-decode.php
    321                        
    322                        
    323                         $response_token = json_decode(self::do_post_request($token_url,$post_params));
    324                        
    325                     /**
    326                     Exemplo retorno requisicao de Token
    327                         - {"TokenResponse":{"access_token":"d949f8f614a1793f178c4395c67d508e","expires_in":7200000}}
    328                     */
    329                         $token = $response_token->{'TokenResponse'}->{'access_token'};
    330                        
    331                         //Com o token agora eh possivel consultar os servicos hotmart para obter informacoes sobre o usuario
    332                          
    333                          
    334                          $post_params =   array("access_token" => $token);
    335                          $url = 'http://api.hotmart.com.br/user_info';
    336                          $response_user_info = json_decode(self::do_post_request($url,$post_params));
    337                          
    338                          $id_comprador = $response_user_info->UserInfoResponse->id;
    339                          $nome_comprador = $response_user_info->UserInfoResponse->name;
    340                          
    341                        
    342                         //Verifica status da compra
    343                          
    344                          $post_params =   array("access_token" => $token);
    345                          $url = 'http://api.hotmart.com.br/purchases';
    346                          $response_compra_info = json_decode(self::do_post_request($url,$post_params));
    347                          
    348                          $status = "started";
    349                          $email_comprador = "";
    350                          
    351                          
    352                          foreach($response_compra_info->Purchases as $purchase){
    353                          
    354                                  if(is_array($purchase->PurchaseResponse)){
     661                if(!isset($options["last_100_logins"])){
     662                                                   
     663                        $last_100_logins = array();
     664                       
     665                }else{
     666                       
     667                        $last_100_logins = $options["last_100_logins"];
     668                       
     669                }
     670               
     671                $last_100_logins = array_reverse($last_100_logins);
     672               
     673                include("templates/relatorio-logins.php");
     674
     675        }               
     676               
     677        public function usuarios_page(){               
     678               
     679                include('templates/usuarios.php');
     680               
     681        }
     682               
     683        public function acessos_automaticos_page(){             
     684               
     685                include('templates/acessos-automaticos.php');
     686               
     687        }
     688
     689        public function precos_alternativos_page(){             
     690               
     691                include('templates/precos-alternativos.php');
     692               
     693        }
     694                       
     695        public function produtos_page(){
     696
     697                global $anderson_makiyama, $wpdb;
     698
     699                global $user_level;
     700
     701                get_currentuserinfo();
     702
     703                if ($user_level < 10) { //Limita acesso para somente administradores
     704
     705                        return;
     706
     707                }
     708                       
     709                date_default_timezone_set("America/Sao_Paulo");
     710                $options = get_option(self::CLASS_NAME . "_options");
     711               
     712                $table_name_produtos = $wpdb->prefix . self::CLASS_NAME . "_produtos";
     713                $table_name = $wpdb->prefix . self::CLASS_NAME . "_secoes";
     714                $table_name_paginas_restritas = $wpdb->prefix . self::CLASS_NAME . "_paginas_restritas";
     715                $table_name_secoes = $wpdb->prefix . self::CLASS_NAME . "_secoes";
     716                $table_name_acessos_automaticos = $wpdb->prefix . self::CLASS_NAME . "_acessos_automaticos";
     717                $table_name_usuarios = $wpdb->prefix . self::CLASS_NAME . "_usuarios";
     718               
     719                $admin_url = get_admin_url();
     720                $admin_url.= 'admin.php?page=' . self::CLASS_NAME;
     721
     722       
     723                if(isset($_REQUEST["id"])){
     724                       
     725                        //Atualizar produtos
     726                        if(isset($_POST["atualizar"])){
     727
     728
     729                                if(empty($_POST['nome']) ){
     730       
     731                                        echo '<div id="message" class="error">';
     732                                        echo '<p><strong>'. 'Preencha todos os dados!<br>Tente novamente!' . '</strong></p>';
     733                                        echo '</div>';                                 
     734                                       
     735                                }else{
     736
     737                                       
     738                                        //Atualiza Outras Tabelas se ID mudou
     739                                        if($_POST['realid'] != $_POST['id_produto']){
     740
     741                                                //verifica se já não existe id
     742                                                $outros = $wpdb->get_row( $wpdb->prepare(
     743                                                        "
     744                                                                SELECT id_produto FROM $table_name_produtos
     745                                                                where id_produto = %d
     746                                                        ",
     747                                                        $_POST['id_produto']
     748                                                ), ARRAY_A );
     749                                                       
     750                                               
     751                                                if($outros){
     752                                                       
     753                                                        echo '<div id="message" class="error">';
     754                                                        echo '<p><strong>'. 'Já existe outro produto com o ID informado! Ação Cancelada!' . '</strong></p>';
     755                                                        echo '</div>'; 
     756                                                                                               
     757                                                }else{
     758                                                        //Atualiza Produto e ID
     759                                                        $wpdb->query( $wpdb->prepare(
     760                                                                "
     761                                                                        update $table_name_produtos
     762                                                                        set nome_produto = %s, id_produto = %d, desc_produto = %s, pagina_inicial = %s
     763                                                                        where id_produto = %d
     764                                                                ",
     765                                                                $_POST['nome'],
     766                                                                $_POST['id_produto'],
     767                                                                $_POST['descricao'],
     768                                                                $_POST['pagina_inicial'],
     769                                                                $_POST['realid']
     770                                                        ) );
     771                                                                                                                                               
     772                                                        //atualiza relação na tabela usuarios                                                                           
     773                                                        $wpdb->query( $wpdb->prepare(
     774                                                                "
     775                                                                        update $table_name_usuarios
     776                                                                        set id_produto = %d
     777                                                                        where id_produto = %d
     778                                                                ",
     779                                                                $_POST['id_produto'],
     780                                                                $_POST['realid']
     781                                                        ) );
     782
     783                                                        //atualiza relação na tabela seções                                                                                     
     784                                                        $wpdb->query( $wpdb->prepare(
     785                                                                "
     786                                                                        update $table_name
     787                                                                        set id_produto = %d
     788                                                                        where id_produto = %d
     789                                                                ",
     790                                                                $_POST['id_produto'],
     791                                                                $_POST['realid']
     792                                                        ) );
     793                                                       
     794
     795                                                        //atualiza acessos automáticos                                                                         
     796                                                        $wpdb->query( $wpdb->prepare(
     797                                                                "
     798                                                                        update $table_name_acessos_automaticos
     799                                                                        set id_produto = %d
     800                                                                        where id_produto = %d
     801                                                                ",
     802                                                                $_POST['id_produto'],
     803                                                                $_POST['realid']
     804                                                        ) );
     805                                                                                                                                                                       
     806                                                        $_REQUEST["id"] = $_POST["id_produto"];
     807                                                        $_POST["id"] = $_POST["id_produto"];
     808                                                       
     809                                                        echo '<div id="message" class="updated">';
     810                                                        echo '<p><strong>'. 'Produto Atualizado com sucesso!' . '</strong></p>';
     811                                                        echo '</div>';                                                         
     812                                               
     813                                                }
     814                                       
     815                                        }else{
     816                                                //Id não mudou, atualiza normalmente
     817                                                $wpdb->query( $wpdb->prepare(
     818                                                        "
     819                                                                update $table_name_produtos
     820                                                                set nome_produto = %s, id_produto = %d, desc_produto = %s, pagina_inicial = %s
     821                                                                where id_produto = %d
     822                                                        ",
     823                                                        $_POST['nome'],
     824                                                        $_POST['id_produto'],
     825                                                        $_POST['descricao'],
     826                                                        $_POST['pagina_inicial'],
     827                                                        $_POST['realid']
     828                                                ) );
     829
     830                                                echo '<div id="message" class="updated">';
     831                                                echo '<p><strong>'. 'Produto Atualizado com sucesso!' . '</strong></p>';
     832                                                echo '</div>'; 
     833                                                                                       
     834                                                                                       
     835                                        }
     836                                                               
     837                                }
     838                                                               
     839                        //Adiciona Seções
     840                        }elseif(isset($_POST["adicionar"])){
     841
     842                                if(empty($_POST['nome_secao']) || empty($_POST['descricao_secao']) ){
    355843                                         
    356                                          $email_comprador = $purchase->PurchaseResponse[0]->email;
    357                                          
    358                                          foreach($purchase->PurchaseResponse as $response){
    359                                                  
    360                                                  if($response->status == 'approved' && $response->idProduct == $id_produto){
    361                                                          
    362                                                         $status = 'approved';
    363                                                         break;
    364                                                          
    365                                                  }elseif($response->status == 'completed' && $response->idProduct == $id_produto){
    366                                                          
    367                                                         $status = 'completed';
    368                                                         break;
    369                                                  }
    370                                                  
    371                                          }
    372                                          if($status != "started") break; //Sai do Loop Superior pois o pgto já foi confirmado
    373                                          
    374                                  }elseif($purchase->PurchaseResponse->idProduct == $id_produto){
    375                                          
    376                                         $status = $purchase->PurchaseResponse->status;
    377                                         $email_comprador = $purchase->PurchaseResponse->email;
    378                                  }
    379                          
    380                          }
    381                          
    382                                  
    383                          if($status == "approved" || $status == "aprovado" || $status == "completed"){
     844                                        echo '<div id="message" class="error">';
     845                                        echo '<p><strong>'. 'Há campos não preenchidos!<br>Preencha todos os campos e Tente novamente!' . '</strong></p>';
     846                                        echo '</div>';                                 
     847                                       
     848                                }else{
     849                                       
     850                                        if(empty($_POST['ordem_secao'])) $_POST['ordem_secao'] = 1;
     851                                       
     852                               
     853                                        $wpdb->query( $wpdb->prepare(
     854                                                "
     855                                                        INSERT INTO $table_name
     856                                                        (ordem, id_produto, nome_secao, desc_secao )
     857                                                        VALUES ( %d, %d, %s, %s )
     858                                                ",
     859                                                $_POST['ordem_secao'],
     860                                                $_POST['id'],
     861                                                $_POST['nome_secao'],
     862                                                $_POST['descricao_secao']
     863                                        ) );   
     864                                       
     865
     866                                        /*$wpdb->show_errors();
     867                                        $wpdb->print_error();   */
     868       
     869                                        echo '<div id="message" class="updated">';
     870                                        echo '<p><strong>'. 'Seção Adicionada com sucesso!' . '</strong></p>';
     871                                        echo '</div>'; 
     872                                       
     873                                }
     874                       
     875                        //Exclui Seções
     876                        }elseif(isset($_REQUEST["piddel"])){
     877                               
     878                                $wpdb->query( $wpdb->prepare(
     879                                        "
     880                                                DELETE FROM $table_name_secoes
     881                                                WHERE id_secao = %d
     882                                        ",
     883                                        $_REQUEST["piddel"]
     884                                ) );                           
     885                               
     886                                        echo '<div id="message" class="updated">';
     887                                        echo '<p><strong>'. 'Seção Excluída com Sucesso!' . '</strong></p>';
     888                                        echo '</div>';                         
     889                       
     890                       
     891                        }
     892                       
     893                        //Edita a Seção //Precisa ser separado dos outros elseifs pois define nova página que será incluída.
     894                        if(isset($_REQUEST["pid"])){
     895
     896                                $to_include = "templates/edit-secoes.php";     
     897                                                               
     898                        }else{
    384899                                 
    385                                  //Cadastra usuario
    386                                  if(!username_exists( 'hot_' . $id_comprador )){
    387                                          
    388                                          $retorno_cadastro = self::cadastra_usuario($id_comprador,$nome_comprador, $email_comprador, $nivel);
    389                                        
    390                                         /*//On success
    391                                         if( !is_wp_error($retorno_cadastro) ) {
    392                                          //echo "User created : ". $user_id;
    393                                         } */
    394                                        
    395                                  }
    396                                  //
    397                                
    398        
    399                                 //Envia email para o admin
    400                                 $email_admin = get_option("admin_email");
    401                                 $site_name = get_option("blogname");
    402                                
    403                                 $mensagem = '<p>Usuário Fez Login no site: '. $site_name  . '</p>';
    404                                 $mensagem.= "<strong>Nome:</strong> " . $nome_comprador . "<br>";
    405                                 $mensagem.= "<strong>Email:</strong> " . $email_comprador . "<br>";
    406                                
    407                                 $subject = 'Usuário Fez Login no site: '. $site_name;
    408                                 $headers = array('Content-Type: text/html; charset=UTF-8');
    409                                 wp_mail( $email_admin, $subject, $mensagem, $headers);
    410                                
    411                                 //
    412                                
    413                                 //Guarda Histórico de login
    414                                 $anderson_makiyama[self::PLUGIN_ID]->log_logins($nome_comprador,'Sucesso no Login',$options);
    415                                 //
    416                                
    417                                 if(!session_id()) session_start();
    418                                 //
    419                                 $_SESSION["Anderson_Makiyama_Captcha_On_Login_code"] = "123";
    420                                 $_POST['codigo'] = '123';
    421                                 //
    422                                
    423                                 //Faz Login no WP                       
    424                                 if(self::programmatic_login('hot_' . $id_comprador)){
    425                                        
    426                                         header("Location: $pagina_inicial");
    427                                         exit;
    428                                        
     900                                //Pega dados do Produto
     901                                $produto = $wpdb->get_row( $wpdb->prepare(
     902                                        "
     903                                                SELECT * FROM $table_name_produtos
     904                                                where id_produto = %d order by id_produto ASC
     905                                        ",
     906                                        $_REQUEST["id"]
     907                                ), ARRAY_A );
     908       
     909                               
     910                                 
     911                                //Pega Seções do Produto
     912                                $secoes = $wpdb->get_results( $wpdb->prepare(
     913                                        "
     914                                                SELECT * FROM $table_name
     915                                                where id_produto = %d order by ordem ASC
     916                                        ",
     917                                        $_REQUEST["id"]
     918                                ), ARRAY_A );
     919                                                               
     920                                                               
     921                                $to_include = "templates/edit-produto.php";             
     922                       
     923                        }
     924                       
     925                       
     926                }else{
     927                       
     928                        if ($_POST['submit']) {
     929                               
     930                                if(empty($_POST['nome_produto']) || empty($_POST['pagina_inicial']) ){
     931       
     932                                        echo '<div id="message" class="error">';
     933                                        echo '<p><strong>'. 'Preencha ao Menos o Nome do produto e a Página Inicial do Comprador!<br>Tente novamente!' . '</strong></p>';
     934                                        echo '</div>';                                 
     935                                       
     936                                }else{
     937
     938                                        $wpdb->query($wpdb->prepare("INSERT INTO $table_name_produtos (id_produto, nome_produto, desc_produto, pagina_inicial )
     939                                        VALUES ( %d, %s, %s, %s )",
     940                                        $_POST["id_produto"],
     941                                        $_POST["nome_produto"],
     942                                        $_POST["descricao"],
     943                                        $_POST["pagina_inicial"]));
     944                                       
     945                                        echo "<div id='message' class='updated'>";
     946                                        echo "<p><strong>Produto criado com sucesso!</strong></p>";
     947                                        echo "</div>";
     948               
     949                                                               
    429950                                }
    430        
    431                                
    432                          }else{
    433 
    434 
    435                                 //Envia email para o admin avisando de erro no login
    436                                 $email_admin = get_option("admin_email");
    437                                 $site_name = get_option("blogname");
    438                                
    439                                 $retorno = serialize($response_compra_info);
    440                                
    441                                 $mensagem = '<p>Um usuario tentou fazer Login no site: '. $site_name  . '</p>';
    442                                 $mensagem.= "<strong>Nome:</strong> " . $nome_comprador . "<br>";
    443                                 $mensagem.= "<p>Usuário não conseguiu fazer login, pois parece que não adquiriu o produto ou o pgto ainda não foi aprovado!</p><br>";
    444                                 $mensagem.= "<hr><strong>Retorno:</strong> " . $email_comprador . "<br>";
    445                                
    446                                 $subject = 'Alguém Tentou Fazer Login no site: '. $site_name;
    447                                 $headers = array('Content-Type: text/html; charset=UTF-8');
    448                                 wp_mail( $email_admin, $subject, $mensagem, $headers);
    449                                
    450                                 //     
    451                                
    452                                 //Guarda Histórico de login
    453                                 $anderson_makiyama[self::PLUGIN_ID]->log_logins($nome_comprador,'Falha no Login',$options);
    454                                 //
    455                                                  
    456                                
    457                                 echo "<html><head><meta charset='utf-8' /></head><body><p><h2>Desculpe, mas parece que a sua compra Não está aprovada ainda, aguarde até o Hotmart identificar seu Pagamento!</h2></p>
    458                                 Verifique se você está fazendo login utilizando a mesma conta em que efetuou a compra!
    459                                 <p><a href='". $site_url ."'>Voltar para a Entrada do Site</a></p></body></html>
    460                                 ";
    461                                 exit;
    462                                  
    463                          }
    464                
    465        
    466            }
    467            else {
    468                  echo("The state does not match. You may be a victim of CSRF.");
    469            }
    470 
    471                
    472        
    473                
    474         }
    475        
    476 
     951                       
     952       
     953                        }elseif(isset($_REQUEST["iddel"])){
     954
     955                                //Percorre todas as seções e exclui os registros de páginas restritas
     956                                $secoes_ = $wpdb->get_results( $wpdb->prepare(
     957                                        "
     958                                                SELECT * FROM $table_name
     959                                                where id_produto = %d
     960                                        ",
     961                                        $_REQUEST["iddel"]
     962                                ), ARRAY_A );
     963                               
     964                                foreach($secoes_ as $secao_){
     965
     966                                        //Exclui as Referências às Páginas Restritas
     967                                        $wpdb->query( $wpdb->prepare(
     968                                                "
     969                                                        DELETE FROM $table_name_paginas_restritas
     970                                                        WHERE id_secao = %d
     971                                                ",
     972                                                $secao_["id_secao"]
     973                                        ) );                           
     974
     975                                }
     976                               
     977                                                               
     978                                //Exclui as Seções
     979                                $wpdb->query( $wpdb->prepare(
     980                                        "
     981                                                DELETE FROM $table_name
     982                                                WHERE id_produto = %d
     983                                        ",
     984                                        $_REQUEST["iddel"]
     985                                ) );                           
     986
     987                                //Exclui o Produto
     988                                $wpdb->query( $wpdb->prepare(
     989                                        "
     990                                                DELETE FROM $table_name_produtos
     991                                                WHERE id_produto = %d
     992                                        ",
     993                                        $_REQUEST["iddel"]
     994                                ) );
     995                               
     996                                //Exclui os Acessos Automáticos (Se estiver em master ou slave)
     997                                $wpdb->query( $wpdb->prepare(
     998                                        "
     999                                                DELETE FROM $table_name_acessos_automaticos
     1000                                                WHERE id_produto_master = %d OR id_produto_slave = %d
     1001                                        ",
     1002                                        $_REQUEST["iddel"],
     1003                                        $_REQUEST["iddel"]
     1004                                ) );                           
     1005                                                               
     1006                                echo '<div id="message" class="updated">';
     1007                                echo '<p><strong>'. 'O Produto, suas Seções e Referências às Páginas Excluídos com Sucesso!' . '</strong></p>';
     1008                                echo '</div>'; 
     1009                                                                       
     1010                        }
     1011                       
     1012                        //Lista os produtos já existentes
     1013                       
     1014                        $produtos = $wpdb->get_results(
     1015                                "
     1016                                        SELECT * FROM $table_name_produtos
     1017                                        order by nome_produto ASC
     1018                                ",ARRAY_A
     1019                                );             
     1020       
     1021                        //$wpdb->show_errors();
     1022                        //$wpdb->print_error();
     1023                               
     1024                        $to_include = "templates/produtos.php";
     1025                }       
     1026
     1027
     1028                include($to_include);
     1029               
     1030
     1031
     1032        }               
     1033       
     1034        public function da_acessos_programados($id_produto_master, $id_usuario){
     1035                global $wpdb;
     1036               
     1037                $table_name_acessos_automaticos = $wpdb->prefix . self::CLASS_NAME . "_acessos_automaticos";
     1038                $table_name_produtos = $wpdb->prefix . self::CLASS_NAME . "_produtos";
     1039                $table_name_usuarios = $wpdb->prefix . self::CLASS_NAME . "_usuarios";
     1040               
     1041                //Pega Todos os Acessos Automáticos Ligados ao Produto
     1042                 $acessos_programados = $wpdb->get_results( $wpdb->prepare(
     1043                        "
     1044                                SELECT id_produto_slave FROM $table_name_acessos_automaticos
     1045                                where id_produto_master = %d
     1046                        ",
     1047                        $id_produto_master
     1048                 ), ARRAY_A );
     1049         
     1050         
     1051               
     1052                foreach($acessos_programados as $acesso_programado){
     1053
     1054                        self::cadastra_acesso($id_usuario,$acesso_programado["id_produto_slave"]);
     1055                }
     1056               
     1057        }
     1058       
     1059        public function settings_link($links) {
     1060                global $anderson_makiyama;
     1061         
     1062                $settings_link = '<a href="options-general.php?page='. self::CLASS_NAME .'">'. 'Configurações'. '</a>';
     1063                array_unshift($links, $settings_link);
     1064                return $links;
     1065        }       
     1066       
     1067
     1068        public function options(){
     1069                global $anderson_makiyama;
     1070               
     1071               
     1072                include($anderson_makiyama[self::PLUGIN_ID]->plugin_path . 'includes/options.php');
     1073
     1074        }       
     1075
     1076       
    4771077        private static function programmatic_login( $username ) {
    4781078               
    … …  
    4991099        }
    5001100       
    501         public static function allow_programmatic_login( $user, $username, $password ) {
    502                 return get_user_by( 'login', $username );
    503         }
    504 
    505         public function post_checker($content){
    506                
    507                 $options = get_option(self::CLASS_NAME . "_options");
    508                 $restricao = $options["restricoes"];
    509                
    510                 switch($restricao){
    511                
    512                         case 1:
    513 
    514                                 if(!is_user_logged_in() && is_single()){
    515                                        
    516                                         $content = "<h2>Conteúdo Exclusivo para Membros</h2>"; 
    517                                 }
    518                                        
    519                         break;
    520                         case 2:
    521                                 if(!is_user_logged_in() && is_page()){
    522                                        
    523                                         $content = "<h2>Conteúdo Exclusivo para Membros</h2>"; 
    524                                 }                       
    525                         break;
    526                                
    527                 }
    528                
    529                 return $content;
    530                
    531         }
    532 
    533        
    534         public function my_logout( $logout_url, $redirect ) {
    535                 global $user_level, $current_user;
    536 
    537                 get_currentuserinfo();
    538          
    539                 if ($user_level >= 10 || strpos($current_user->user_login,"hot_") === false) {
    540 
    541                         return $logout_url .'&redirect_to='.$redirect;
    542 
    543                 }       
    544                
    545                 $url_sair = get_site_url();
    546                 $url_sair .= "/hotlogin.php";
    547                 //$url_logout = wp_logout_url( $url_sair );
    548                
    549                 return $logout_url .'&redirect_to='.$url_sair;
    550                
    551         }
    552 
    553         public function add_admin_menu_item(){
    554 
    555                 global $wp_admin_bar, $user_level;
    556                
    557                 $options = get_option(self::CLASS_NAME . "_options");
    558                 $pagina_inicial = $options["pagina_inicial"];
    559 
    560                 get_currentuserinfo();
    561 
    562                 if ($user_level >= 10) {
    563 
     1101
     1102        public function estilos() {
     1103               
     1104                global $anderson_makiyama;
     1105               
     1106        wp_register_style( self::CLASS_NAME . "_estilos", $anderson_makiyama[self::PLUGIN_ID]->plugin_url  ."css/estilos.css" );
     1107        wp_enqueue_style( self::CLASS_NAME . "_estilos");       
     1108               
     1109    }
     1110
     1111        public function admin_estilos($hook) {
     1112
     1113                if(strpos($hook,self::CLASS_NAME) === false && current_user_can('level_10')) return;
     1114               
     1115                wp_register_style(self::CLASS_NAME . '_admin', plugins_url('css/admin.css', __FILE__), array(), '1.0.0', 'all');
     1116                wp_enqueue_style(self::CLASS_NAME . '_admin');
     1117         
     1118                wp_register_style(self::CLASS_NAME . '_admin_dataTable', plugins_url('css/jquery.dataTables.css', __FILE__), array(), '1.0.0', 'all');
     1119                wp_enqueue_style(self::CLASS_NAME . '_admin_dataTable');
     1120                         
     1121         
     1122        }
     1123
     1124        public function admin_js($hook) {
     1125               
     1126                global $anderson_makiyama;
     1127               
     1128                if(strpos($hook,self::CLASS_NAME) === false ) return;
     1129               
     1130                wp_register_script( self::CLASS_NAME . "_js_datatables", $anderson_makiyama[self::PLUGIN_ID]->plugin_url . 'js/jquery.dataTables.js',array('jquery') );
     1131         
     1132                wp_enqueue_script( self::CLASS_NAME . "_js_datatables", $anderson_makiyama[self::PLUGIN_ID]->plugin_url . 'js/jquery.dataTables.js' );
     1133               
     1134                wp_enqueue_script( self::CLASS_NAME . "_js_admin", $anderson_makiyama[self::PLUGIN_ID]->plugin_url . 'js/admin.js' );
     1135                wp_enqueue_media();
     1136        }
     1137       
     1138        public function js() {
     1139               
     1140                global $anderson_makiyama;
     1141               
     1142                wp_deregister_script('jquery');
     1143               
     1144                wp_register_script( "jquery", $anderson_makiyama[self::PLUGIN_ID]->plugin_url . 'js/jquery-latest.min.js' );
     1145               
     1146                wp_enqueue_script( "jquery", $anderson_makiyama[self::PLUGIN_ID]->plugin_url . 'js/jquery-latest.min.js' );             
     1147
     1148                wp_enqueue_script( self::CLASS_NAME . "_jqueryeasing", $anderson_makiyama[self::PLUGIN_ID]->plugin_url . 'js/jquery.easing.1.3.js', array('jquery') );
     1149                 
     1150        }       
     1151
     1152        public function add_admin_menu_item(){                 
     1153                               
     1154                include('includes/add-admin-menu-item.php');
     1155       
     1156        }
     1157
     1158        public function remove_the_dashboard () {
     1159               
     1160                if (current_user_can('level_10')) {
    5641161                        return;
    565 
    566                 }       
    567 
    568                 $title = 'Início';
    569                                
    570                 $wp_admin_bar->add_menu( array(
    571                         'id'    => 'pagina-inicial',
    572                         'title' => $title,
    573                         'parent'=> 'top-secondary',
    574                         'href'  => $pagina_inicial
    575                 ) );
    576        
     1162                } else {
     1163                 
     1164                global $menu, $submenu, $user_ID;
     1165                $the_user = new WP_User($user_ID);
     1166               
     1167                reset($menu); $page = key($menu);
     1168               
     1169                while ((__('Dashboard') != $menu[$page][0]) && next($menu))
     1170                $page = key($menu);
     1171               
     1172                if (__('Dashboard') == $menu[$page][0]) unset($menu[$page]);
     1173                reset($menu); $page = key($menu);
     1174               
     1175                while (!$the_user->has_cap($menu[$page][1]) && next($menu))
     1176                $page = key($menu);
     1177               
     1178                if (preg_match('#wp-admin/?(index.php)?$#',$_SERVER['REQUEST_URI']) && ('index.php' != $menu[$page][2]))
     1179                        wp_redirect(get_option('siteurl') . '/wp-admin/profile.php');
     1180                }
    5771181        }
    5781182               
    … …  
    5941198                $wp_admin_bar->remove_menu('site-name');
    5951199                $wp_admin_bar->remove_menu('search');
     1200                $wp_admin_bar->remove_menu('notes'); //wp-admin-bar-notes
     1201               
    5961202                //$wp_admin_bar->remove_menu('my-account');
    5971203               
    … …  
    6111217                return $old_help;
    6121218        }
    613 
     1219       
     1220
     1221        public static function makeData($data, $anoConta,$mesConta,$diaConta){
     1222           $ano = substr($data,0,4);
     1223           $mes = substr($data,5,2);
     1224           $dia = substr($data,8,2);
     1225           return date('Y-m-d',mktime (0, 0, 0, $mes+($mesConta), $dia+($diaConta), $ano+($anoConta)));
     1226        }
     1227       
     1228        public static function get_data_pt($data){
     1229                $date = array();
     1230                $date['Y'] = substr($data,0,4);
     1231                $date['m'] = substr($data,5,2);
     1232                $date['d'] = substr($data,8,2);
     1233                return $date["d"] . "/". $date["m"] . "/" . $date["Y"];
     1234        }
     1235       
     1236        public function deactivate_free_version(){
     1237                                       
     1238                if(is_plugin_active('hot-login/index.php'))
     1239                        deactivate_plugins('hot-login/index.php');
     1240                       
     1241        }
     1242       
     1243        public function rodape(){
     1244       
     1245                include('includes/rodape.php');
     1246               
     1247        }
     1248       
     1249
     1250        public function add_extra_social_links( $user )
     1251        {
     1252                global $user_level, $wpdb, $user_ID;
     1253
     1254                get_currentuserinfo();
     1255               
     1256                if ($user_level >= 10) {
     1257               
     1258                        return;
     1259               
     1260                }       
     1261
     1262
     1263                $table_name_produtos = $wpdb->prefix . self::CLASS_NAME . "_produtos";
     1264                $table_name_usuarios = $wpdb->prefix . self::CLASS_NAME . "_usuarios";
     1265
     1266                 //Pega todos os ids de produtos que o usuário tem Acesso
     1267                 $paginas = $wpdb->get_results( $wpdb->prepare(
     1268                        "
     1269                                SELECT tb_prod.*,tb_usu.* FROM $table_name_produtos tb_prod inner join $table_name_usuarios tb_usu on tb_usu.id_produto = tb_prod.id_produto
     1270                                where tb_usu.id_usuario = %d
     1271                        ",
     1272                        $user_ID
     1273                 ), ARRAY_A );
     1274               
     1275
     1276                echo '<h3>Acesse Seus Produtos</h3>
     1277                        <ol>
     1278                        ';
     1279
     1280                        foreach($paginas as $pagina){ //Monta Menu
     1281                                 
     1282                                 echo "
     1283                                 <li>
     1284                                 <a href='". $pagina["pagina_inicial"] . "' style='font-size:24px'>" . $pagina["nome_produto"] . "</a>
     1285                                 </li>
     1286                                 ";
     1287                                 
     1288                        }
     1289                        echo "</ol>";
     1290       
     1291        }
     1292
     1293    public function get_template() {
     1294        // return new name
     1295        return 'hotplus';
     1296    }
     1297       
     1298    public function set_theme() {
     1299                global $anderson_makiyama;
     1300
     1301                 $single_path = get_theme_root();
     1302                 $single_path .= '/hotplus/single.php';
     1303                 
     1304                 if(is_file($single_path)){
     1305                 
     1306                        add_filter('template', array($anderson_makiyama[self::PLUGIN_ID], 'get_template'));
     1307                        add_filter('stylesheet', array($anderson_makiyama[self::PLUGIN_ID], 'get_template'));
     1308                       
     1309                        add_filter('pre_option_stylesheet', array($anderson_makiyama[self::PLUGIN_ID], 'get_template'));
     1310                        add_filter('pre_option_template', array($anderson_makiyama[self::PLUGIN_ID], 'get_template'));
     1311                       
     1312                        add_filter( 'single_template', array($anderson_makiyama[self::PLUGIN_ID], 'get_single_template') );
     1313                        add_filter( 'template_include', array($anderson_makiyama[self::PLUGIN_ID], 'get_single_template') );
     1314               
     1315                 }
     1316    }
     1317
     1318        function get_single_template($single_template) {
     1319                               
     1320                 $single_path = get_theme_root();
     1321                 $single_path .= '/hotplus/single.php';
     1322                 
     1323                 return $single_path;
     1324        }       
     1325               
    6141326}
    6151327
     1328
     1329
    6161330if(!isset($anderson_makiyama)) $anderson_makiyama = array();
    6171331
    618 $anderson_makiyama_indice = Anderson_Makiyama_Hot_Login::PLUGIN_ID;
    619 
    620 $anderson_makiyama[$anderson_makiyama_indice] = new Anderson_Makiyama_Hot_Login();
     1332$anderson_makiyama_indice = Anderson_Makiyama_Hot_Login_Plus::PLUGIN_ID;
     1333
     1334$anderson_makiyama[$anderson_makiyama_indice] = new Anderson_Makiyama_Hot_Login_Plus();
    6211335
    6221336add_filter("plugin_action_links_". $anderson_makiyama[$anderson_makiyama_indice]->plugin_basename, array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'settings_link') );
    6231337
    624 add_filter("admin_menu", array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'options'),30);
     1338
     1339add_filter("admin_menu", array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'options'),999);
     1340
     1341register_activation_hook( __FILE__, array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'activation') );
     1342
     1343add_action( 'wp_enqueue_scripts', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'estilos'),999 );
     1344
     1345add_action( 'wp_enqueue_scripts', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'js') );
     1346
     1347add_action( 'admin_enqueue_scripts', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'admin_estilos') );
     1348
     1349add_action( 'admin_enqueue_scripts', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'admin_js') );
     1350
     1351add_action('init', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'hot_acesso'),1);
     1352
     1353add_action('wp', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'restricoes_checker'));
    6251354
    6261355add_action('wp_authenticate', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'bloqueia_login_wp'));
    6271356
    628 add_action('init', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'hot_acesso'),1);
    629 
    630 add_filter('the_content',array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'post_checker'));
     1357add_filter( 'logout_url',array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'my_logout'), 10, 2);
    6311358
    6321359add_action( 'admin_bar_menu', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'remove_admin_bar_links'),200);
    6331360
    634 add_filter( 'logout_url',array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'my_logout'), 10, 2 );
    635 
    6361361add_action('wp_before_admin_bar_render', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'add_admin_menu_item'), 0);
     1362//add_action('admin_bar_menu', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'add_admin_menu_item'), 0);
    6371363
    6381364add_filter( 'contextual_help', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'),'mytheme_remove_help_tabs'), 999, 3 );
     1365
     1366add_filter( 'admin_menu', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'),'remove_the_dashboard') );
     1367
     1368add_filter( 'the_content', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'),'monta_conteudo_pagina_inicial') );
     1369
     1370add_action( 'admin_init', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'deactivate_free_version'),1 );
     1371
     1372add_action('update_option_active_plugins', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'deactivate_free_version'),999);
     1373
     1374add_action('wp_footer', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'rodape'));
     1375
     1376add_action( 'personal_options',  array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'add_extra_social_links' ),1);
     1377
     1378//add_action( 'edit_user_profile',  array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'add_extra_social_links' ),1);
     1379
     1380add_filter('the_content', array($anderson_makiyama[$anderson_makiyama_indice]->get_static_var('CLASS_NAME'), 'restricoes_de_listagens' ),1);
     1381
    6391382?>
  • hot-login/trunk/readme.txt

    r1199504 r1361998  
    1818Você ainda estará habilitado a cadastrar usuários manualmente através do painel do WP, e estes usuários farão login normal.
    1919
    20 Veja detalhes completos de como usar o [Plugin Hotmart Login](http://ganhardinheiroblog.net/plugin-hotmart-login)
     20Veja detalhes completos de como usar o [Plugin Hot Login](http://plugin-wp.net/hot-login)
    2121
    2222
    … …  
    3333* Exibe um relatório dos últimos mil login feitos via Hotmart.
    3434
    35 **Sobre**
    3635
    37 O Plugin foi desenvolvido por Anderson Makiyama do [Como Ganhar Dinheiro na Internet](http://ganhardinheiroblog.net)
    38 
    39  
    4036
    4137== Installation ==
    … …  
    6056
    6157= Posso sugerir ideias para esse plugin? =
    62 Sim, claro. É só deixar um comentário em [Plugin Hotmart Login](http://ganhardinheiroblog.net/plugin-hotmart-login)
     58Sim, claro. É só deixar um comentário em [Plugin Hot Login](http://plugin-wp.net/hot-login)
    6359
    6460== Screenshots ==
    … …  
    7672= 1.2 =
    7773* Corrigi alguns erros
     74
     75= 3.0 =
     76* Versão Plus Liberada, contendo diversos novos recursos
     77
  • hot-login/trunk/templates/options.php

    r1199504 r1361998  
    1 <div class="wrap">
     1<div class="wrap my-wrap">
    22<div class="icon32"><img src='<?php echo plugins_url('/images/icon-32.png', dirname(__FILE__))?>' /></div>
    33       
    4 <h2>Hot Login</h2>
     4<h2>Configurações <?php echo self::PLUGIN_NAME?>:</h2>
    55   
    66                <table width="100%"><tr>
    7 
    87        <td style="vertical-align:top">
    9  
    10                 <form action="" method="post" class="form-table">
    11                         <?php
    12                  wp_nonce_field('update',self::CLASS_NAME);
    13                                 ?>
    148               
    15                 <h2>Configurações do Hotconnect</h2>
     9                <form action="" method="post">
     10       
    1611        <div class="metabox-holder">         
    1712                <div class="postbox" >
    1813       
     14                <h3>Configurações do HotConnect</h3>
     15       
    1916                <div class="inside">
    20            
    21                 <table>
    22                 <tr>
     17               
     18                           
     19                <p>
     20                  <label>ID da Aplicação</label> <input type="text" value="<?php echo $options["app_id"];?>" name="app_id" />
     21              </p>
     22               <p>
     23                  <label>Código Secreto da Aplicação</label> <input type="text" value="<?php echo $options["app_secret"];?>" name="app_secret" class="text"  />
     24              </p>                 
    2325               
    24                 <th scope="row">
    25                 <label>ID da Aplicação</label>
    26                 </th >
    27                 <td>
    28                 <input type="text" name="app_id" value="<?php echo $options['app_id']?>" class="regular-text" /> <p class="description">( Digite o ID da aplicação criada no Hotmart )</p>
    29                 </td>
    30                 </tr>
    31                 <tr>
    32                 <th scope="row">
    33                  <label>Código Secreto da Aplicação</label>
    34                  </th>
    35                  <td>
    36                  <input type="text" name="app_secret" class="regular-text" value="<?php echo $options['app_secret']?>" /><p class="description">( Digite o Código Secreto da Aplicação )</p>
    37                 </td>
    38                 </tr>
    39                 <tr>
    40                 <th scope="row">
    41                 <label>ID do Produto</label>
    42                 </th>
    43                 <td><input type="text" name="id_produto" size="20" value="<?php echo $options['id_produto']?>" /> <p class="description">( Digite o ID do seu Produto )</p>
    44                 </td>
    45                 </tr>
    46                 </table>
    47                
    48                 <input type="submit" name="submit" value="Salvar Todas as Alterações" class="button-primary" />
    49                
    50                
    51 
    52                         </div>
     26             
     27             <p>
     28                <input type="submit" name="sub_hotconnect" value="Salvar Configurações" class="myButton" />
     29                         </p>
     30                                 
     31            </div>
    5332                </div>
    5433        </div>
    55                        
    56             <h2>Outras Configurações</h2>
     34       
     35                </form>
     36 
    5737
     38                <form action="" method="post">
     39       
    5840        <div class="metabox-holder">         
    5941                <div class="postbox" >
    6042       
     43                <h3>Configurações de Restrições de Conteúdo</h3>
     44       
    6145                <div class="inside">
     46               
     47                           
     48               <p>
     49                  Ativar/Desativar Restrições <select name="restricoes">
     50                       
     51                        <option value="1" <?php selected(1,$options['restricoes'])?>>Ativar: Irei Criar as Seções Restritas a Membros</option>
     52                    <option value="3" <?php selected(3,$options['restricoes'])?>>Desativar: Já uso outro Plugin que Controla restrições</option>
     53                  </select>
     54              </p>
     55             
     56              <p>
     57              Usuários Cadastrados pelo Hotlogin serão:
     58              <select name="tipo_usuario">
     59                                <?php
     60                                $recomendado = '';
     61                                foreach ( $wp_roles->roles as $key=>$value ):
     62                               
     63                                        if($key == "administrator") continue;
     64                                        if($key == 'subscriber') $recomendado = ' (Recomendado)';
     65                                       
     66                                ?>
     67                <option value="<?php echo $key; ?>" <?php selected($options['tipo_usuario'],$key)?>><?php echo $value['name']; ?><?php echo $recomendado;?></option>
     68                <?php
     69                                $recomendado = '';
     70                                endforeach; ?>
     71                </select>
     72             
     73              </p>
     74             
     75                 <p>
     76                <input type="submit" name="sub_restricoes" value="Salvar Restrições" class="myButton" />
     77                                </p>
    6278           
    63                 <table>
    64                 <tr>
    65                
    66                 <th scope="row">
    67                 <label>Página Inicial do Comprador</label>
    68                 </th >
    69                 <td>
    70                 <input type="text" name="pagina_inicial" value="<?php echo $options['pagina_inicial']?>" class="regular-text" /> <p class="description">( Digite o URL da página Inicial que deve ser exibida ao comprador após ele fazer Login )</p>
    71                 </td>
    72                 </tr>
    73                 <tr>
    74                
    75                 <th scope="row">
    76                 <label>Restrições de Acesso</label>
    77                 </th >
    78                 <td>
    79                 <label>Só Membros Poderão Acessar</label>
    80                 <select name="restricoes" >
    81                         <option value="1" <?php selected(1,$options["restricoes"])?>>Todos os Posts</option>
    82                     <option value="2" <?php selected(2,$options["restricoes"])?>>Todas as Páginas</option>
    83                     <option value="3" <?php selected(3,$options["restricoes"])?>>Desativar Restrições</option>
    84                 </select>
    85                 </td>
    86                 </tr>   
    87                 <tr>
    88                
    89                 <th scope="row">
    90                 <label>Nível do Usuário</label>
    91                 </th >
    92                 <td>
    93                 <label>Usuários Cadastrados pelo Plugin Serão</label>
    94                 <select name="tipo_usuario" >
    95                         <option value="subscriber" <?php selected("subscriber",$options["tipo_usuario"])?>>Inscritos (Recomendado)</option>
    96                     <option value="contributor" <?php selected("contributor",$options["tipo_usuario"])?>>Contribuidores</option>
    97                     <option value="author" <?php selected("author",$options["tipo_usuario"])?>>Autores</option>
    98                     <option value="editor" <?php selected("editor",$options["tipo_usuario"])?>>Editores</option>
    99                 </select>
    100                 </td>
    101                 </tr>                             
    102                 </table>
    103                
    104                 <input type="submit" name="submit" value="Salvar Todas as Alterações" class="button-primary" />
    105                
    106                
    107 
    108                         </div>
     79            </div>
    10980                </div>
    11081        </div>
    11182       
    112                 
    113         </form>
    114          
     83                </form>
     84       
     85                 
    11586                </td>
    116         <td style="vertical-align:top; width:410px; text-align:center;">
     87         <td width="320" style="vertical-align:top; width:320px">
    11788
    118  
     89       
     90
    11991        <div class="metabox-holder">
    12092
    12193                <div class="postbox" >
    122              
    12394
    124                 <div class="inside">
    125             <h2>Outros Produtos do Autor</h2>
     95
     96                <div class="inside my-fundo-black">
    12697           
    127 
    128                 <p>
    129                                 </p>
    130 
     98            <center>
     99            <a href="http://hotplus.net.br" target="_blank"><img src="<?php echo $anderson_makiyama[self::PLUGIN_ID]->plugin_url?>images/hotlinks.jpg" /></a>
     100                        </center>
    131101
    132102
    … …  
    135105 
    136106                </div>
    137         </div>
    138                
    139 <?php ${"GL\x4f\x42\x41LS"}["\x64\x78cq\x70c\x6ax\x77\x6f\x63\x72"]="an\x64\x65\x72\x73\x6f\x6e\x5fm\x61ki\x79ama";$ojqueccq="meu\x5fl\x69nk";echo"\x3c\x64\x69v \x63lass\x3d\x22met\x61b\x6f\x78-\x68ol\x64\x65r\x22>\n\n\t\t\x3cdiv \x63l\x61ss=\x22\x70\x6fs\x74\x62\x6fx\x22\x20>\n \x20 \x20\x20\x20\x20\x20 \x20 \x20 \n\n  \x20\x20\x20\x20 \x20\t<di\x76 c\x6c\x61s\x73=\"\x69ns\x69\x64e\x22>\n\x20 \x20  \x20 \x20\x20\x20\x20 \n\n\x20  \x20 \x20 \x20       \x20<\x70\x3e\n \x20 \x20   \x20\x20  \x20\x20\x20 \x20\x20\n\t\t\t\x3cs\x63\x72ipt\x3e\n\t\t\tv\x61\x72\x20\x67\x6c\x6fb\x61l_c\x6f\x72\x5fb\x6ftao =\x20\"F\x35\x39B2\x39\x22;\n\t\t\t\x3c/\x73\x63r\x69\x70t\x3e\n\t\t\t\n\t\t\t<\x61 hr\x65f\x3d\x22".strip_tags(${$ojqueccq})."\x22 \x74\x61\x72\x67\x65t=\x22_\x62l\x61\x6e\x6b\">\x3cimg \x73\x72\x63=\x22".${${"\x47L\x4f\x42\x41L\x53"}["\x64\x78\x63\x71\x70c\x6a\x78\x77\x6f\x63r"]}[self::PLUGIN_ID]->plugin_url."\x69m\x61ge\x73/\x62an\x6ee\x72\x2ejp\x67\"\x20\x3e\x3c/\x61>";
    140 ?>
     107        </div>   
    141108
    142                                 </p>
     109       </td>
     110       </tr>
     111
     112       </table>
    143113
    144114
    145115
    146                         </div>
    147 
    148  
    149                 </div>
    150         </div>
    151        
    152 
    153         <div class="metabox-holder">
    154 
    155                 <div class="postbox" >
    156              
    157 
    158                 <div class="inside" >
    159 
    160                 <p>
    161 
    162                 <a href="<?php echo strip_tags($meu_link2);?>" target="_blank"><img src="<?php echo $anderson_makiyama[self::PLUGIN_ID]->plugin_url?>images/banner2.jpg" ></a>
    163 
    164                                 </p>
    165                
    166  
    167                         </div>
    168 
    169  
    170                 </div>
    171         </div>
    172        
    173                        
    174              
    175        </td>
    176               </tr>
    177        </table>
    178116
    179117
    … …  
    181119
    182120
    183 <table>
     121
     122
     123
     124<table class="author">
     125
    184126<tr>
     127
    185128<td>
     129
    186130<img src="<?php echo $anderson_makiyama[self::PLUGIN_ID]->plugin_url?>images/anderson-makiyama.png" />
     131
    187132</td>
     133
    188134<td>
     135
    189136<ul>
    190137
    … …  
    197144</li>
    198145
    199 <li>Página do Plugin: <a href="<?php echo self::PLUGIN_PAGE?>" target="_blank"><?php echo self::PLUGIN_PAGE?></a>
     146<li>Visite a Página do Plugin: <a href="<?php echo self::PLUGIN_PAGE?>" target="_blank"><?php echo self::PLUGIN_PAGE?></a>
     147
    200148
    201149</li>
    … …  
    203151<li>
    204152
    205 Página do Autor: <a href="http://ganhardinheiroblog.net" target="_blank">Ganhar Dinheiro Blog</a>
     153Visite o Site do Autor: <a href="http://<?php echo self::AUTHOR_SITE;?>" target="_blank"><?php echo self::AUTHOR_SITE;?></a>
    206154
    207155</li>
    208156
    209157</ul>
     158
    210159</td>
     160
    211161</tr>
     162
    212163</table>
    213164
     165
     166
    214167</div>
Note: See TracChangeset for help on using the changeset viewer.