Changeset 81

Show
Ignore:
Timestamp:
02/15/08 15:35:58 (9 months ago)
Author:
root
Message:

added some features, fixed akismet check

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/settings.php

    r79 r81  
    127127                <br /><span style="padding-left:10px;display:block;clear:left;"> 
    128128                <textarea name="wassup_exclude" rows="4" cols="40"><?php print $wassup_settings['wassup_exclude']; ?></textarea></span><?php _e("comma separated value (ex: 127.0.0.1, 10.0.0.1, etc...)", "wassup") ?></p> 
     129                <br /><p><strong><?php _e('Enter requested URLs to exclude from recording','wassup'); ?></strong>: 
     130                <br /><span style="padding-left:10px;display:block;clear:left;"> 
     131                <textarea name="wassup_exclude_url" rows="4" cols="40"><?php print $wassup_settings['wassup_exclude_url']; ?></textarea></span><?php _e("comma separated value, don't put the entire url, only the last path or some word to exclude (ex: /category/wordpress, 2007, etc...)", "wassup") ?></p> 
    129132                <br /><br /> 
    130133        <?php   $tab=2; 
  • trunk/wassup.php

    r79 r81  
    5757        'wassup_refspam' => "0", 
    5858        'wassup_exclude' => "", 
     59        'wassup_exclude_url' => "", 
    5960        'wassup_savepath' => null, 
    6061        'wassup_chart' => "1", 
     
    402403                $wassup_settings['wassup_refspam'] = $_POST['wassup_refspam']; 
    403404                $wassup_settings['wassup_exclude'] = $_POST['wassup_exclude']; 
     405                $wassup_settings['wassup_exclude_url'] = $_POST['wassup_exclude_url']; 
    404406                $wassup_settings['delete_auto'] = $_POST['delete_auto']; 
    405407                $wassup_settings['delete_auto_size'] = $_POST['delete_auto_size']; 
     
    656658                        $markedtot = $Tot->calc_tot("count", $search, "AND ip LIKE '%".$wassup_settings['wip']."%'", "DISTINCT"); 
    657659                } 
     660                // Check if some records was searched 
     661                if (!empty($search)) { 
     662                        $searchtot = $Tot->calc_tot("count", $search, null, "DISTINCT"); 
     663                } 
    658664 
    659665 
     
    729735                        <li><span style="border-bottom:2px dashed #FF6D06;"><?php echo $pagestot; ?></span> <small><?php _e('Pageviews','wassup'); ?></small></li> 
    730736                        <li><span><?php echo @number_format(($pagestot/$itemstot), 2); ?></span> <small><?php _e('Pages/Visits','wassup'); ?></small></li> 
    731                         <li><span><a href="#TB_inline?height=55&width=400&inlineId=hiddenspam" class="thickbox"><?php echo $spamtot; ?></a></span> <span>(<?php echo @number_format(($spamtot*100/$pagestot), 2); ?>%)</span> <small><?php _e('Spams','wassup'); ?></small></li> 
     737                        <li><span><a href="#TB_inline?height=180&width=300&inlineId=hiddenspam" class="thickbox"><?php echo $spamtot; ?></a></span> <span>(<?php echo @number_format(($spamtot*100/$pagestot), 2); ?>%)</span> <small><?php _e('Spams','wassup'); ?></small></li> 
    732738                        </ul> 
    733739                <?php 
     
    778784                <td align="left" style="font-size: 11px;"> 
    779785                <?php 
    780                 if ($wassup_settings['wmark'] == 1) echo '<a href="?'.$_SERVER['QUERY_STRING'].'&search='.$wassup_settings['wip'].'" title="'.__('Filter by marked IP','wassup').'"><strong>'.$markedtot.'</strong> '.__('visits marked','wassup').'</a> - '; 
    781                 if ($search != "") print __('Searched for','wassup').": <strong>$search</strong> - "; 
     786                if ($wassup_settings['wmark'] == 1) echo '<a href="?'.$_SERVER['QUERY_STRING'].'&search='.$wassup_settings['wip'].'" title="'.__('Filter by marked IP','wassup').'"><strong>'.$markedtot.'</strong> '.__('show marked items','wassup').'</a> - '; 
     787                if (!empty($search)) print "<strong>$searchtot</strong>".__('Searched for','wassup').": <strong>$search</strong> - "; 
    782788                echo __('Auto refresh in','wassup').' <span id="CountDownPanel"></span> '.__('seconds','wassup'); ?> 
    783789                </td> 
     
    10951101        if (empty($wassup_settings['wassup_exclude']) || 
    10961102             strstr($wassup_settings['wassup_exclude'],$ipAddress) == FALSE) { 
    1097  
     1103         
     1104        //## check if url requested is not on exclusion list... 
     1105        if (!empty($wassup_settings['wassup_exclude_url'])) { 
     1106                $exclude_url_list = explode(",", $wassup_settings['wassup_exclude_url']); 
     1107                foreach ($exclude_url_list as $exclude_url) { 
     1108                        if (stristr($urlRequested, trim($exclude_url)) !== FALSE) { 
     1109                                $flag_exclude_url = 1; 
     1110                        } 
     1111                } 
     1112        } 
     1113        if ($flag_exclude_url != 1) { 
     1114         
    10981115        //### Exclude requests for themes, plugins, and favicon from recordings 
    10991116        if (stristr($urlRequested,"favicon.ico") === FALSE) {           //moved 
     
    12921309                $akismet = new Akismet($wpurl, $akismet_key, $Acomment); 
    12931310 
    1294                 // Check if it's spam 
    1295                 if ( $akismet->isSpam() ) { 
    1296                         $spam = 1; 
     1311                // Check if it's Akismet spam but before continuing 
     1312                // double check if there is some errors connecting with Akismet 
     1313                if($akismet->errorsExist()) {  
     1314                // returns true if any errors exist  
     1315                        if($akismet->isError('AKISMET_INVALID_KEY')) {  
     1316                        unset($spamresult); 
     1317                        } elseif($akismet->isError('AKISMET_RESPONSE_FAILED')) {  
     1318                        unset($spamresult); 
     1319                        } elseif($akismet->isError('AKISMET_SERVER_NOT_FOUND')) {  
     1320                        unset($spamresult); 
     1321                        }  
     1322                } else { 
     1323                // ok no errors connecting to Akismet, go on check for spam 
     1324                        if ( $akismet->isSpam() ) { 
     1325                                $spam = 1; 
     1326                        } 
     1327                        $spamresult = $spam; 
    12971328                } 
    12981329                // test for errors 
    12991330                //#error means don't record Akismet result in session... 
    1300                 if($akismet->errorsExist()) { 
    1301                         unset($spamresult); 
    1302  
    1303                         // no need to alter spam for errors...spam=0 already set by default 
    1304                         // returns true if any errors exist  
    1305                         //if($akismet->isError('AKISMET_INVALID_KEY')) {  
    1306                         //      $spam = 0; 
    1307                         //} elseif($akismet->isError('AKISMET_RESPONSE_FAILED')) {  
    1308                         //      $spam = 0; 
    1309                         //} elseif($akismet->isError('AKISMET_SERVER_NOT_FOUND')) {  
    1310                         //      $spam = 0; 
    1311                         //}  
    1312                 } else { 
    1313                         $spamresult = $spam; 
    1314                 } 
    13151331           //end if akismet_key 
    13161332           } else {      
     
    14281444 
    14291445        } //end if wassup_exclude 
     1446        } //end if wassup_exclude_url 
    14301447        } //end if wassup_active 
    14311448        } //end if !is_admin