Changeset 102 for trunk

Show
Ignore:
Timestamp:
02/29/08 15:12:21 (10 months ago)
Author:
root
Message:

1.4.8 testing

Location:
trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/settings.php

    r96 r102  
    2828        $adminemail = get_bloginfo('admin_email'); 
    2929 
    30         if ($wassup_settings['wassup_remind_flag'] == 2) { 
     30        if ($wassup_options->wassup_remind_flag == 2) { 
    3131                $alert_msg = '<p style="color:red;font-weight:bold;">'.__('ATTENTION! Your WassUp table have reached the maximum value you set, I disabled the alert, you can re-enable it here.','wassup').'</p>'; 
    32                 $wassup_settings['wassup_remind_flag'] = 0; 
    33                 update_option('wassup_settings', $wassup_settings); 
     32                $wassup_options->wassup_remind_flag = 0; 
     33                $wassup_options->saveSettings(); 
    3434        } 
    3535        $alertstyle = 'color:red; background-color:#ffd;'; 
     
    4242        //</script> ?> 
    4343        <style type="text/css"> 
    44           h3 { margin-bottom:0px; padding-bottom:5px; color:#333; } 
     44          h3 { margin-bottom:0px; padding-bottom:5px; color:#333; } 
     45          #fragment-1,#fragment-2,#fragment-3,#fragment-4 { background-color: #dee; } 
     46          #tab_container ul li { min-width:60px; display:inline; } 
    4547          form p { margin-top:0px; padding-top:0px; padding-left:15px; } 
    4648        </style> 
     
    5153 
    5254        <div id="tab_container"> 
    53             <ul> 
     55            <ul style="clear:both;"> 
    5456                <li><a href="#fragment-1"><span><?php _e("General Setup", "wassup") ?></span></a></li> 
    5557                <li<?php if ($_GET['tab'] == "2"  || isset($_POST['submit-options2'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#fragment-2"><span><?php _e("Statistics Recording", "wassup") ?></span></a></li> 
    5658                <li<?php if ($_GET['tab'] == "3"  || isset($_POST['submit-options3'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#fragment-3"><span><?php _e("Manage Files & Database", "wassup") ?></span></a></li> 
     59                <li<?php if ($_GET['tab'] == "4"  || isset($_POST['submit-options4'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#fragment-4"><span><?php _e("Uninstall", "wassup") ?></span></a></li> 
    5760            </ul> 
    5861 
     
    6164                <!-- //Added by Helene D. to use more browser width to display visitor detail... --> 
    6265                <br /><h3><?php _e('Your default screen resolution (browser width)','wassup'); ?></h3> 
    63                 <p><?php _e('Default screen resolution (in pixels)','wassup'); ?>: 
    64                 <select name='wassup_screen_res' style="width: 90px"> 
    65                 <option value='640' <?php if ($wassup_settings['wassup_screen_res'] == "640") { print "SELECTED"; } ?>> 640</option> 
    66                 <option value='800' <?php if ($wassup_settings['wassup_screen_res'] == "800") { print "SELECTED"; } ?>> 800</option> 
    67                 <option value='1024' <?php if ($wassup_settings['wassup_screen_res'] == "1024") { print "SELECTED"; } ?>> 1024</option> 
    68                 <option value='1200' <?php if ($wassup_settings['wassup_screen_res'] == "1200") { print "SELECTED"; } ?>> 1200</option> 
     66                <p><strong><?php _e('Default screen resolution (in pixels)','wassup'); ?></strong>: 
     67                <select name='wassup_screen_res' style="width: 90px;"> 
     68                <?php $wassup_options->showFormOptions("wassup_screen_res"); ?> 
    6969                </select> 
    7070                </p> 
    7171                <br /><h3><?php _e('Set minimum users level which can view and manage WassUp plugin (default Administrators)','wassup'); ?></h3> 
    7272                <p><select name="wassup_userlevel"> 
    73                 <option value="">--</option> 
    74                 <option value="8" <?php if($wassup_settings['wassup_userlevel'] == "8") echo 'SELECTED'; ?>><?php _e('Administrators','wassup'); ?></option> 
    75                 <option value="6" <?php if($wassup_settings['wassup_userlevel'] == "6") print "SELECTED"; ?>><?php _e('Contributors','wassup'); ?></option> 
    76                 <option value="2" <?php if($wassup_settings['wassup_userlevel'] == "2") print "SELECTED"; ?>><?php _e('Authors','wassup'); ?></option> 
     73                <?php $wassup_options->showFormOptions("wassup_userlevel"); ?> 
    7774                </select></p><br /> 
    7875 
    7976                <br /><h3><?php _e('Visit Detail Settings','wassup'); ?></h3> 
    80                 <p><strong><?php _e('Chart type - How many axes:','wassup'); ?></strong>: 
     77                <p><strong><?php _e('Chart type - How many axes','wassup'); ?></strong>: 
    8178                <select name='wassup_chart_type'> 
    82                         <option value='1' <?php if ($wassup_settings['wassup_chart_type'] == "1") { print "SELECTED"; } ?>><?php _e("One", "wassup") ?>&nbsp;&nbsp;</option> 
    83                         <option value='2' <?php if ($wassup_settings['wassup_chart_type'] == "2") { print "SELECTED"; } ?>><?php _e("Two", "wassup") ?>  </option> 
     79                <?php $wassup_options->showFormOptions("wassup_chart_type"); ?> 
    8480                </select> 
    8581                </p><br /> 
    8682                <p> 
    87                 <strong><?php echo __('Set how many minutes wait for automatic page refresh','wassup').'</strong> (<strong>'.__('Current Visitors Online and Visitors Details','wassup').'</strong>):'; ?> 
    88                 <input type="text" name="wassup_refresh" size="2" value="<?php print $wassup_settings['wassup_refresh']; ?>" /> <?php _e('refresh minutes (default 3)','wassup'); ?></p><br /> 
     83                <strong><?php echo __('Set how many minutes wait for automatic page refresh','wassup').'</strong> ('.__('Current Visitors Online and Visitors Details','wassup').'):'; ?> 
     84                <input type="text" name="wassup_refresh" size="2" value="<?php print $wassup_options->wassup_refresh; ?>" /> <?php _e('refresh minutes (default 3)','wassup'); ?></p><br /> 
    8985 
    9086                <p><strong><?php _e('Show visitor details for','wassup'); ?></strong>: 
    9187                <select name='wassup_default_type'> 
    92                         <option value='everything' <?php if ($wassup_settings['wassup_default_type'] == "everything") { print "SELECTED"; } ?>><?php _e("Everything", "wassup") ?></option> 
    93                         <option value='spider' <?php if ($wassup_settings['wassup_default_type'] == "spider") { print "SELECTED"; } ?>><?php _e("Spiders", "wassup") ?></option> 
    94                         <option value='nospider' <?php if ($wassup_settings['wassup_default_type'] == "nospider") { print "SELECTED"; } ?>><?php _e("NO Spiders", "wassup") ?></option> 
    95                         <option value='spam' <?php if ($wassup_settings['wassup_default_type'] == "spam") { print "SELECTED"; } ?>><?php _e("Spam", "wassup") ?></option> 
    96                         <option value='nospam' <?php if ($wassup_settings['wassup_default_type'] == "nospam") { print "SELECTED"; } ?>><?php _e("NO Spam", "wassup") ?></option> 
    97                         <option value='nospamspider' <?php if ($wassup_settings['wassup_default_type'] == "nospamspider") { print "SELECTED"; } ?>><?php _e("NO Spam NO Spider", "wassup") ?></option> 
    98                         <option value='loggedin' <?php if ($wassup_settings['wassup_default_type'] == "loggedin") { print "SELECTED"; } ?>><?php _e("Users logged in", "wassup") ?></option> 
    99                         <option value='comauthor' <?php if ($wassup_settings['wassup_default_type'] == "comauthor") { print "SELECTED"; } ?>><?php _e("Comment authors", "wassup") ?></option> 
    100                         <option value='searchengine' <?php if ($wassup_settings['wassup_default_type'] == "searchengine") { print "SELECTED"; } ?>><?php _e("Referer from search engine", "wassup") ?></option> 
    101                         <option value='referrer' <?php if ($wassup_settings['wassup_default_type'] == "referrer") { print "SELECTED"; } ?>><?php _e("Referer from ext link", "wassup") ?></option> 
     88                <?php $wassup_options->showFormOptions("wassup_default_type"); ?> 
    10289                </select> 
    10390                </p><br /> 
    10491                <p><strong><?php _e('Number of items per page','wassup'); ?></strong>: 
    10592                <select name='wassup_default_limit'> 
    106                         <option value='10' <?php if ($wassup_settings['wassup_default_limit'] == "10") { print "SELECTED"; } ?>>10</option> 
    107                         <option value='20' <?php if ($wassup_settings['wassup_default_limit'] == "20") { print "SELECTED"; } ?>>20</option> 
    108                         <option value='50' <?php if ($wassup_settings['wassup_default_limit'] == "50") { print "SELECTED"; } ?>>50</option> 
    109                         <option value='100' <?php if ($wassup_settings['wassup_default_limit'] == "100") { print "SELECTED"; } ?>>100</option> 
     93                <?php $wassup_options->showFormOptions("wassup_default_limit"); ?> 
    11094                </select> 
    11195                </p> 
    11296                <br /><br /> 
    113         <?php   $tab=""; 
    114                 echo '<p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options" value="'.__('Save Settings','wassup').'" />&nbsp;<input type="reset" name="reset" value="'.__('Reset','wassup').'" /> - <input type="submit" name="reset-to-default" value="'.__("Reset to Default Settings", "wassup").'" /></p><br />'; ?> 
     97                <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br /> 
    11598           </div> 
    11699 
    117100           <div id="fragment-2"> 
    118101                <br /><h3><?php _e('Statistics Recording Settings','wassup'); ?></h3> 
    119                 <p> <input type="checkbox" name="wassup_active" value="1" <?php if($wassup_settings['wassup_active'] == 1) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Recording','wassup'); ?></strong></p> 
     102                <p> <input type="checkbox" name="wassup_active" value="1" <?php if($wassup_options->wassup_active == 1) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Recording','wassup'); ?></strong></p> 
    120103                <p style="margin-top:5px;"> <strong> <?php _e("Checkbox to record statistics for each type of \"visitor\"", "wassup") ?></strong><br /> 
    121104                <span style="padding-left:25px;padding-top:0;margin-top:0;display:block;clear:left;"> 
    122                 <input type="checkbox" name="wassup_loggedin" value="1" <?php if($wassup_settings['wassup_loggedin'] == 1) print "CHECKED"; ?> /> <?php _e("Record logged in users", "wassup") ?><br /> 
    123                 <input type="checkbox" name="wassup_spider" value="1" <?php if($wassup_settings['wassup_spider'] == 1) print "CHECKED"; ?> /> <?php _e("Record spiders and bots", "wassup") ?><br /> 
    124                 <input type="checkbox" name="wassup_attack" value="1" <?php if($wassup_settings['wassup_attack'] == 1) print "CHECKED"; ?> /> <?php _e("Record attack/exploit attempts (libwww-perl agent)", "wassup") ?><br /> 
     105                <input type="checkbox" name="wassup_loggedin" value="1" <?php if($wassup_options->wassup_loggedin == 1) print "CHECKED"; ?> /> <?php _e("Record logged in users", "wassup") ?><br /> 
     106                <input type="checkbox" name="wassup_spider" value="1" <?php if($wassup_options->wassup_spider == 1) print "CHECKED"; ?> /> <?php _e("Record spiders and bots", "wassup") ?><br /> 
     107                <input type="checkbox" name="wassup_attack" value="1" <?php if($wassup_options->wassup_attack == 1) print "CHECKED"; ?> /> <?php _e("Record attack/exploit attempts (libwww-perl agent)", "wassup") ?><br /> 
    125108                </span> 
    126109                </p> 
    127                 <br /><p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_settings['wassup_spamcheck'] == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p> 
     110                <br /><p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_options->wassup_spamcheck == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p> 
    128111                <p style="margin-top:5px;"> <strong> <?php _e('Checkbox to record statistics for each type of "spam"','wassup'); ?></strong><br /> 
    129112                <span style="padding-left:25px;padding-top:0;margin-top:0;display:block;clear:left;"> 
    130                 <input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_settings['wassup_spam'] == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?> (check if an IP has previous comments as spam)<br /> 
    131                 <input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_settings['wassup_refspam'] == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?><br /> 
     113                <input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_options->wassup_spam == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?> (check if an IP has previous comments as spam)<br /> 
     114                <input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_options->wassup_refspam == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?><br /> 
    132115                </span> 
    133116                </p> 
    134117                <br /><p><strong><?php _e('Enter source IPs to exclude from recording','wassup'); ?></strong>: 
    135118                <br /><span style="padding-left:10px;display:block;clear:left;"> 
    136                 <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> 
     119                <textarea name="wassup_exclude" rows="4" cols="40"><?php print $wassup_options->wassup_exclude; ?></textarea></span><?php _e("comma separated value (ex: 127.0.0.1, 10.0.0.1, etc...)", "wassup") ?></p> 
    137120                <br /><p><strong><?php _e('Enter requested URLs to exclude from recording','wassup'); ?></strong>: 
    138121                <br /><span style="padding-left:10px;display:block;clear:left;"> 
    139                 <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> 
     122                <textarea name="wassup_exclude_url" rows="4" cols="40"><?php print $wassup_options->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> 
    140123                <br /><br /> 
    141         <?php   $tab=2; 
    142                 echo '<p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options'.$tab.'" value="'.__('Save Settings','wassup').'" />&nbsp;<input type="reset" name="reset" value="'.__('Reset','wassup').'" /> - <input type="submit" name="reset-to-default" value="'.__("Reset to Default Settings", "wassup").'" /></p><br />'; ?> 
     124                <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options2" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br /> 
    143125           </div> 
    144126         
     
    146128                <h3><?php _e('Temporary files location folder','wassup'); ?></h3><p> 
    147129<?php  
    148                 echo '<strong>'.__('"Save path" directory for storing temporary files used to track visitor activity','wassup').'</strong>:</p>'; 
    149                 $sessionpath = wGetSessionpath(); 
    150                 if (!empty($wassup_settings['wassup_savepath']) && $wassup_settings['wassup_savepath'] != $sessionpath ) { 
    151                         $sessionpath = $wassup_settings['wassup_savepath']; 
    152                 } 
     130                echo '<strong>'.__('"Save path" directory for storing temporary files used to track visitor activity','wassup').'</strong>:'; 
     131                $sessionpath = $wassup_options->getSavepath(); 
    153132                //$sessionpath = "/fakefolder/temp";    //#debug 
    154133                $sessionstyle = ''; 
    155134                //# check that session_save_path exists and is writable... 
    156                 if ( !file_exists($sessionpath)) { 
     135                if ($wassup_options->isWritableFolder($sessionpath) == false) { 
    157136                        $sessionwarn = '<small style="'.$alertstyle.' font-weight:bold; padding-left:5px;"><span style="text-decoration:blink;">'.__('WARNING','wassup').'!</span> '.__('Directory does not exist or is not writable. Please enter a different path above or change "session.save_path" in "php.ini" to point to a valid, writable folder','wassup').'.</small>'; 
    158137                        $sessionstyle = $alertstyle; 
    159138                } else { 
    160                         //#check that the directory is writable... 
    161                         $sessiontestfile = $sessionpath."/temp".time().'.txt'; 
    162                         if (@touch($sessiontestfile)) { 
    163                                 $sessionwarn ='<small style="padding-left:5px;">'.__('Note: To adjust, change the above path or edit "sessions.save_path" in','wassup').' "php.ini".</small>'; 
    164                                 unlink($sessiontestfile); 
    165                         } else { 
    166                                 $sessionwarn = '<small style="'.$alertstyle.' font-weight:bold; padding-left:5px;"><span style="text-decoration:blink;">'.__('WARNING','wassup').'!</span> '.__('Directory does not exist or is not writable. Please enter a different path above or change "session.save_path" in "php.ini" to point to a valid, writable folder','wassup').'.</small>'; 
    167                                 $sessionstyle = $alertstyle; 
    168                         } 
    169          
     139                        $sessionwarn ='<small style="padding-left:5px;">'.__('Note: To adjust, change the above path or edit "sessions.save_path" in','wassup').' "php.ini".</small>'; 
    170140                }        
    171141                echo '<textarea name="wassup_savepath" rows="1" style="width:550px;padding-left:25px;clear:left; '.$sessionstyle.'">'.$sessionpath.'</textarea>'."\n"; 
     
    178148                <p><?php _e('Current WassUp table usage is','wassup'); 
    179149                print ': <strong>';  
    180                 if ( (int)$tusage >= (int)$wassup_settings['wassup_remind_mb']) {  
     150                if ( (int)$tusage >= (int)$wassup_options->wassup_remind_mb) {  
    181151                        print '<span style="'.$alertstyle.'">'.$tusage.'</span>'; 
    182152                } else { print $tusage; } 
    183153                print ' Mb</strong> ('.$data_rows.' '.__('records','wassup').')</p>'."\n"; 
    184154                print $alert_msg; ?> 
    185                 <br /><p><input type="checkbox" name="wassup_remind_flag" value="1" <?php if ($wassup_settings['wassup_remind_flag'] == 1) print "CHECKED"; ?>>  
    186                 <strong><?php _e('Alert me','wassup'); ?></strong> (<?php _e('email to','wassup'); ?>: <strong><?php print $adminemail; ?></strong>) <?php _e('when table reaches','wassup'); ?> <input type="text" name="wassup_remind_mb" size="3" value="<?php print $wassup_settings['wassup_remind_mb']; ?>"> Mb</p> 
     155                <br /><p><input type="checkbox" name="wassup_remind_flag" value="1" <?php if ($wassup_options->wassup_remind_flag == 1) print "CHECKED"; ?>>  
     156                <strong><?php _e('Alert me','wassup'); ?></strong> (<?php _e('email to','wassup'); ?>: <strong><?php print $adminemail; ?></strong>) <?php _e('when table reaches','wassup'); ?> <input type="text" name="wassup_remind_mb" size="3" value="<?php print $wassup_options->wassup_remind_mb; ?>"> Mb</p> 
    187157                <p><input type="checkbox" name="wassup_empty" value="1">  
    188158                <strong><?php _e('Empty table','wassup'); ?></strong> (<a href="?<?php print $_SERVER['QUERY_STRING']; ?>&export=1"><?php _e('export table in SQL format','wassup'); ?></a>)</p> 
    189159                <br /><p><strong><?php _e("Automatically delete records older than:", "wassup") ?></strong>  
    190160                <select name="delete_auto"> 
    191                 <option value="never" <?php if($wassup_settings['delete_auto'] == "never") print "SELECTED"; ?>><?php _e("Don't delete anything", "wassup") ?></option> 
    192                 <option value="-1 day" <?php if($wassup_settings['delete_auto'] == "-1 day") print "SELECTED"; ?>><?php _e("24 hours", "wassup") ?></option> 
    193                 <option value="-1 week" <?php if($wassup_settings['delete_auto'] == "-1 week") print "SELECTED"; ?>><?php _e("1 week", "wassup") ?></option> 
    194                 <option value="-1 month" <?php if($wassup_settings['delete_auto'] == "-1 month") print "SELECTED"; ?>><?php _e("1 month", "wassup") ?></option> 
    195                 <option value="-3 months" <?php if($wassup_settings['delete_auto'] == "-3 months") print "SELECTED"; ?>><?php _e("3 months", "wassup") ?></option> 
    196                 <option value="-6 months" <?php if($wassup_settings['delete_auto'] == "-6 months") print "SELECTED"; ?>><?php _e("6 months", "wassup") ?></option> 
    197                 <option value="-1 year" <?php if($wassup_settings['delete_auto'] == "-1 year") print "SELECTED"; ?>><?php _e("1 year", "wassup") ?></option> 
     161                <?php $wassup_options->showFormOptions("delete_auto"); ?> 
    198162                </select></p> 
    199163                <br /><p><?php _e("Delete NOW records older than:", "wassup") ?>  
    200164                <select name="delete_manual"> 
    201                 <option value="never"><?php _e("Action is NOT undoable", "wassup") ?></option> 
     165                <option value="never"><?php _e("Action is NOT undoable", "wassup") ?> &nbsp;</option> 
    202166                <option value="-1 day"><?php _e("24 hours", "wassup") ?></option> 
    203167                <option value="-1 week"><?php _e("1 week", "wassup") ?></option> 
     
    208172                </select></p> 
    209173                <br /><br /> 
    210         <?php   $tab=3; 
    211                 echo '<p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options'.$tab.'" value="'.__('Save Settings','wassup').'" />&nbsp;<input type="reset" name="reset" value="'.__('Reset','wassup').'" /> - <input type="submit" name="reset-to-default" value="'.__("Reset to Default Settings", "wassup").'" /></p><br />'; ?> 
     174                <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options3" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br /> 
     175           </div> 
     176         
     177           <div id="fragment-4"><br /> 
     178                <h3><?php _e('Want to uninstall WassUp?', 'wassup') ;?></h3> 
     179                <p><?php _e('No problem. Before you deactivate this plugin, check the box below to cleanup any data that was collected by WassUp that could be left behind.', 'wassup') ;?></p><br /> 
     180                <p><input type="checkbox" name="wassup_uninstall" value="1" <?php if ($wassup_options->wassup_uninstall == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Permanently remove WassUp data and settings from Wordpress','wassup'); ?></strong></p> 
     181                <?php if ($wassup_options->wassup_uninstall == 1) { ?> 
     182                        <small style="<?php echo $alertstyle.'font-weight:bold; margin-left:20px;'; ?>"><span style="text-decoration:blink;padding-left:5px;"><?php _e("WARNING","wassup"); ?>! </span><?php _e("All WassUp data and settings will be deleted upon deactivation of this plugin","wassup"); ?>.</small><br /> 
     183                <?php } ?> 
     184                <br /><p><?php _e("This action cannot be undone. Before uninstalling WassUp, you should backup your Wordpress database first. WassUp data is stored in the table", "wassup"); ?> <strong>wp_wassup</strong>.</p> 
     185 
     186                <br /><p><?php _e("To help improve this plugin, we would appreciate your feedback at","wassup"); ?> <a href="http://www.wpwp.org">www.wpwp.org</a>.</p> 
     187                <br /><br /> 
     188                <p style="padding-left:0;padding-top:15px;"><input type="submit" name="submit-options4" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br /> 
    212189           </div> 
    213190        </form> 
  • trunk/wassup.css

    r63 r102  
    3838        color: #DDD; 
    3939} 
    40  
     40.legend { 
     41        font-size: 11px; 
     42} 
    4143.sum { 
    4244        position: relative; 
  • trunk/wassup.php

    r100 r102  
    44Plugin URI: http://www.wpwp.org 
    55Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics. 
    6 Version: 1.4.7 
     6Version: 1.4.8 
    77Author: Michele Marcucci 
    88Author URI: http://www.michelem.org/ 
     
    1717        die('Permission Denied! You are not allowed to call this page directly.'); 
    1818} 
    19 $version = "1.4.7"; 
     19$version = "1.4.8"; 
    2020define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE); 
     21require_once(dirname(__FILE__).'/lib/wassup.class.php'); 
    2122require_once(dirname(__FILE__).'/lib/main.php'); 
    2223$wpurl = get_bloginfo('wpurl'); 
     
    2728 
    2829global $wp_version; 
     30 
    2931/* 
    3032if (!defined('SECRET_KEY')) { 
     
    3537        add_action('admin_notices', 'wassup_warning'); 
    3638        return; 
     39} 
    3740*/ 
    3841//#This works only in WP2.2 or higher 
     
    4043        wp_die( '<strong style="color:#c00;background-color:#dff;padding:5px;">'.__("Sorry, Wassup requires WordPress 2.2 or higher to work","wassup").'.</strong>'); 
    4144} else { 
    42         register_activation_hook( __FILE__, 'wassup_install' ); 
     45        register_activation_hook(__FILE__, 'wassup_install'); 
     46        register_deactivation_hook(__FILE__, 'wassup_uninstall'); 
    4347        add_action('admin_head', 'add_wassup_css'); 
    4448        add_action('wp_head', 'add_wassup_meta_info'); 
     
    4953} 
    5054 
    51 //#initial wassup settings for options this is here because 
    52 //I need it in more then one function (using global) 
    53 $defaultWdata = array( 
    54         'wassup_active' => "1", 
    55         'wassup_loggedin' => "1", 
    56         'wassup_spider' => "1", 
    57         'wassup_attack' => "1", 
    58         'wassup_spamcheck' => "1", 
    59         'wassup_spam' => "1", 
    60         'wassup_refspam' => "1", 
    61         'wassup_exclude' => "", 
    62         'wassup_exclude_url' => "", 
    63         'wassup_savepath' => null, 
    64         'wassup_chart' => "1", 
    65         'wassup_chart_type' => "1", 
    66         'delete_auto' => "never", 
    67         'delete_auto_size' => "0", 
    68         'wassup_remind_mb' => "0", 
    69         'wassup_remind_flag' => "0", 
    70         'wassup_refresh' => "3", 
    71         'wassup_userlevel' => "8", 
    72         'wassup_screen_res' => "800", 
    73         'wassup_default_type' => "everything", 
    74         'wassup_default_limit' => "10", 
    75         'wassup_widget_title' => "Visitors Online", 
    76         'wassup_widget_ulclass' => "links", 
    77         'wassup_widget_loggedin' => "1", 
    78         'wassup_widget_comauth' => "1", 
    79         'wassup_widget_search' => "1", 
    80         'wassup_widget_searchlimit' => "5", 
    81         'wassup_widget_ref' => "1", 
    82         'wassup_widget_reflimit' => "5", 
    83         'wassup_widget_topbr' => "1", 
    84         'wassup_widget_topbrlimit' => "5", 
    85         'wassup_widget_topos' => "1", 
    86         'wassup_widget_toposlimit' => "5", 
    87         'wassup_widget_chars' => "18" 
    88         ); 
    89  
    90 //#add initial options and create table when Wassup activated 
     55//#add initial options and create table when Wassup activated  
     56//  -Helene D. 2/26/08. 
    9157function wassup_install() { 
    92   global $wpdb, $defaultWdata; 
    93   //### add/update wassup settings to Wordpress options table 
    94   $wassup_settings = get_option('wassup_settings'); 
    95   if (empty($wassup_settings)) { 
    96         //# initialize wassup settings to default values 
    97         add_option('wassup_settings', $defaultWdata, 'Options for WassUp'); 
    98  
    99   } else { 
    100         //# update wassup settings for 'spamcheck', 'refspam', and 'spam' 
    101         if (!isset($wassup_settings['wassup_spamcheck'])) { 
    102            $wassup_settings['wassup_spamcheck'] = "0"; 
    103            //#set wassup_spamcheck=0 if wassup_refspam=0 and wassup_spam=0 
    104            if (!isset($wassup_settings['wassup_spam']) && !isset($wassup_settings['wassup_refspam'])) { 
    105                 $wassup_settings['wassup_spam'] = "1"; 
    106                 $wassup_settings['wassup_refspam'] = "1"; 
    107            } elseif ( $wassup_settings['wassup_spam'] == "0" && $wassup_settings['wassup_refspam'] == "0" ) {  
    108                 $wassup_settings['wassup_spamcheck'] = "0"; 
    109            } 
     58        global $wpdb; 
     59 
     60        //### Add/update wassup settings in Wordpress options table 
     61        $wassup_options = new wassupOptions; //#settings initialized here 
     62        // 
     63        //### For upgrade of Wassup, manually initialize any new settings 
     64        //# initialize settings for 'spamcheck', 'refspam', and 'spam' 
     65        if (!isset($wassup_options->wassup_spamcheck)) { 
     66                $wassup_options->wassup_spamcheck = "0"; 
     67                //#set wassup_spamcheck=0 if wassup_refspam=0 and wassup_spam=0 
     68                if (!isset($wassup_options->wassup_spam) && !isset($wassup_options->wassup_refspam)) { 
     69                        $wassup_options->wassup_spam = "1"; 
     70                        $wassup_options->wassup_refspam = "1"; 
     71                } elseif ( $wassup_options->wassup_spam == "0" && $wassup_options->wassup_refspam == "0" ) {  
     72                        $wassup_options->wassup_spamcheck = "0"; 
     73                } 
     74        } 
     75        //# update wassup settings for 'savepath' (default is null) 
     76        if (!isset($wassup_options->wassup_savepath)) { 
     77                $wassup_options->wassup_savepath = null; 
     78        } 
     79        //# display google chart by default for upgrades from 1.4.4 
     80        if (!isset($wassup_options->wassup_chart)) { 
     81                $wassup_options->wassup_chart = 1; 
     82        } 
     83        //$wassup_options->wassup_savepath = "/fakedirectory"; //#debug 
     84        $wassup_options->saveSettings(); 
     85 
     86        //### Detect problems with WassUp install and show warning 
     87        //#  
     88        //#Check for problems with 'session_savepath' and disable  
     89        //#  recording, if found.  -Helene D. 2/24/08 
     90        $sessionpath = $wassup_options->getSavepath(); 
     91        if ($wassup_options->isWritableFolder($sessionpath) == false) { 
     92                if ($wassup_options->wassup_active == "1") { 
     93                        $wassup_options->wassup_active = "0"; 
     94                        $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Statistics logging has been disabled as a result. To fix, go to admin menu, "Wassup-->Options-->Manage Files & Database" and modify "Temporary files location folder".','wassup'); 
     95                } else { 
     96                        $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Please fix by modifying "Temporary files location folder" in admin menu, "Wassup-->Options-->Manage Files & Database".','wassup'); 
     97                } 
     98                $wassup_options->saveSettings(); 
    11099        } 
    111         //# update wassup settings for 'savepath' (default is null) 
    112         if (!isset($wassup_settings['wassup_savepath'])) { 
    113                 $wassup_settings['wassup_savepath'] = null; 
    114                 //$wassup_settings['wassup_savepath'] = "/tmp"; #debug 
    115         } 
    116         //# display google chart by default for upgrades from 1.4.4 
    117         if (!isset($wassup_settings['wassup_chart'])) { 
    118                 $wassup_settings['wassup_chart'] = 1; 
    119         } 
    120         //#save wassup settings changes 
    121         update_option('wassup_settings', $wassup_settings); 
    122   } 
    123  
    124   //### create/upgrade wassup table 
    125   $table_name = $wpdb->prefix . "wassup"; 
    126   if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { 
    127         CreateTable(); 
    128   } else { 
    129         UpdateTable(); 
    130   } 
     100        //# TODO: 
     101        //###Detect known incompatible plugins like "wp_cache" and disable  
     102        //#  recordings and show warning message... 
     103 
     104        //### Create/upgrade wassup table 
     105        $table_name = $wpdb->prefix . "wassup"; 
     106        if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {  
     107                CreateTable(); 
     108        } else { 
     109                UpdateTable(); 
     110        } 
    131111} //#end function wassup_install 
    132112 
    133 $wassup_settings = get_option('wassup_settings'); 
     113$wassup_settings = get_option('wassup_settings'); //temp only.. 
     114$wassup_options = new wassupOptions;  
     115//$wassup_options->loadSettings();      //done automatically  
     116 
     117//#Completely remove all wassup tables and options from Wordpress when 
     118//# the 'wassup_uninstall' option is set and plugin is deactivated. 
     119//#  -Helene D. 2/26/08 
     120function wassup_uninstall() { 
     121        global $wassup_options; 
     122        if ($wassup_options->wassup_uninstall == "1") { 
     123                $table_name = $wpdb->prefix . "wassup"; 
     124                $wpdb->query("DROP TABLE $table_name"); 
     125                $wassup_options->deleteSettings();  
     126        } 
     127} //#end function wassup_uninstall 
    134128 
    135129function add_wassup_meta_info() { 
     
    173167//Add the wassup stylesheet and other javascripts... 
    174168function add_wassup_css() { 
    175         global $wpurl; 
     169        global $wpurl, $wassup_options; 
    176170        $plugin_page = attribute_escape($_GET['page']); 
    177171 
     
    179173        //Add css and javascript to wassup menu pages only... 
    180174        if ($plugin_page == "wassup") { 
    181                 $wassup_settings = get_option('wassup_settings'); 
    182                 //$siteurl =  get_bloginfo('siteurl');  //not used 
    183                 //$wpurl =  get_bloginfo('wpurl');      //global 
    184  
     175                //$wassup_settings = get_option('wassup_settings'); 
    185176                echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/wassup.css'.'" type="text/css" />'; 
    186177                echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.css'.'" type="text/css" />'; 
    187178                echo '<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/ui.tabs.css'.'" type="text/css" />'; 
    188179 
    189 // Add some javascripts 
    190180if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?> 
    191181<script type='text/javascript'> 
     
    194184        location.href='?<?php print $_SERVER['QUERY_STRING']; ?>'; 
    195185  } 
    196   setTimeout('selfRefresh()', <?php print ($wassup_settings['wassup_refresh'] * 60000); ?>); 
     186  setTimeout('selfRefresh()', <?php print ($wassup_options->wassup_refresh * 60000); ?>); 
    197187  //]]> 
    198188</script> 
     
    230220  window.onload=WindowLoad; 
    231221  function WindowLoad(event) { 
    232         ActivateCountDown("CountDownPanel", <?php print ($wassup_settings['wassup_refresh'] * 60); ?>); 
     222        ActivateCountDown("CountDownPanel", <?php print ($wassup_options->wassup_refresh * 60); ?>); 
    233223  } 
    234224  //]]> 
     
    236226 
    237227<script type="text/javascript"> 
    238   // Main script for Ajax functions 
    239228  //<![CDATA[ 
    240229  jQuery(document).ready(function($){ 
     
    252241           var id = $(this).attr('id'); 
    253242                 $.ajax({ 
    254                   url: "<?php echo $wpurl; ?>/wp-content/plugins/<?php echo WASSUPFOLDER; ?>/lib/action.php?action=delete&whash=<?php echo $whash; ?>&id=" + id, 
     243                  url: "<?php echo $wpurl; ?>/wp-content/plugins/<?php echo WASSUPFOLDER; ?>/lib/action.php?action=delete&whash=<?php echo $whash; ?>&id=" + id, 
    255244                  async: false 
    256245                 }) 
     
    315304<?php 
    316305if ($_GET['page'] == "wassup-options") { 
    317         //#Current active tabs are indentified after page reload via  
     306        //#Current active tabs are indentified after page reload with  
    318307        //#  either $_GET['tab']=N or $_POST['submit-optionsN'] where  
    319308        //#  N=tab number. The tab is then activated directly in  
     
    367356//put WassUp in the top-level admin menu and add submenus....