Changeset 131
- Timestamp:
- 04/20/08 17:50:20 (7 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
lib/action.php (modified) (6 diffs)
-
lib/settings.php (modified) (1 diff)
-
lib/wassup.class.php (modified) (5 diffs)
-
wassup.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/action.php
r130 r131 2 2 // action.php -- perform an action that renders an output to the browser 3 3 4 //force browser to disable caching to make action.php workas an ajax request4 //force browser to disable caching so action.php works as an ajax request 5 5 header("Expires: Fri, 22 Jun 2007 05:00:00 GMT"); // Date in the past 6 6 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified … … 8 8 header('Cache-Control: no-store, no-cache, must-revalidate'); 9 9 header('Cache-Control: post-check=0, pre-check=0', false); 10 //echo "\n"; 10 11 //#debug... 11 12 //error_reporting(E_ALL | E_STRICT); //debug, E_STRICT=php5 only 12 13 //ini_set('display_errors','On'); //debug 13 //echo "\n"; //debug14 14 15 15 //#check for required files and include them 16 16 if (!defined('ABSPATH')) { 17 define ('ABSPATH', substr(__FILE__,0,strpos(__FILE__,'/wp-content/')+1)); 18 if (file_exists(ABSPATH. 'wp-blog-header.php')) { 19 include_once(ABSPATH. 'wp-blog-header.php'); 20 } 17 $wpabspath=substr(__FILE__,0,strpos(__FILE__,'/wp-content/')+1); 18 if (file_exists($wpabspath. 'wp-blog-header.php')) { 19 include_once($wpabspath. 'wp-blog-header.php'); 20 } 21 } else { 22 $wpabspath=ABSPATH; 21 23 } 22 24 if (!function_exists('get_bloginfo')) { 23 if (file_exists( ABSPATH. 'wp-config.php')) {24 include_once( ABSPATH.'wp-config.php');25 if (file_exists($wpabspath. 'wp-config.php')) { 26 include_once($wpabspath.'wp-config.php'); 25 27 } else { 26 echo '<span style="font-color:red;">Action.php '.__('ERROR: file not found','wassup').', '.ABSPATH.'wp-config.php</span>'; 27 exit(); 28 //Note: localization functions, _e() and __(), are not used 29 // here because they would not be defined if this error 30 // occurred 31 echo '<span style="font-color:red;">Action.php ERROR: file not found, '.$wpabspath.'wp-config.php</span>'; 32 die(); 28 33 } 29 34 } … … 38 43 //echo "Debug: Starting action.php from directory ".dirname(__FILE__).". ABSPATH=".ABSPATH.".<br />\n"; //debug 39 44 45 //#set required variables 46 $siteurl = get_bloginfo('siteurl'); 47 $wpurl = get_bloginfo('wpurl'); 48 $table_name = $wpdb->prefix . "wassup"; 49 $wassup_settings = get_option('wassup_settings'); 50 if (!defined('WASSUPFOLDER')) { 51 define('WASSUPFOLDER', substr(__FILE__,0,strpos(__FILE__,'/lib/')+1)); 52 } 53 40 54 //#do a hash check 41 if (function_exists('wp_hash')) { //in case it was not loaded by WP 55 $hashfail = true; 56 if (isset($_GET['whash']) && $_GET['whash'] == $wassup_settings['whash']) { 42 57 $hashfail = false; 43 if (!empty($_GET['whash'])) {44 if (defined('SECRET_KEY') && $_GET['whash'] == wp_hash(SECRET_KEY)) {45 $hashfail = false;46 } elseif ($_GET['whash'] == wp_hash('wassup')) {47 $hashfail = false;48 }49 }50 } else {51 $hashfail = true;52 58 } 53 59 //#perform the "action" and display the result … … 71 77 exit(); 72 78 } 73 74 //#set required variables75 $siteurl = get_bloginfo('siteurl');76 $wpurl = get_bloginfo('wpurl');77 $table_name = $wpdb->prefix . "wassup";78 $wassup_settings = get_option('wassup_settings');79 79 80 80 //#perform action and display output … … 138 138 // ACTION: RUN TOP TEN 139 139 } elseif ($_GET['action'] == "topten") { 140 $top_ten = unserialize($wassup_settings['wassup_top10']); 140 141 $sitedomain = parse_url($siteurl); 141 142 $sitedomain = $sitedomain['host']; 142 143 if (empty($max_char_len)) { 143 144 $max_char_len = ($wassup_settings['wassup_screen_res'])/10; 145 } 146 //#add an extra width offset when columns count < 5 147 $col_count = 0; 148 foreach ($top_ten as $topitem) { 149 if ($topitem == 1) { $col_count = $col_count+1; } 150 } 151 if ($col_count > 0 && $col_count < 5 ) { 152 $widthoffset = (($max_char_len*(5 - $col_count))/$col_count)*.4; //just a guess 153 } else { 154 $widthoffset = 0; 144 155 } 145 156 //only exclude spam if it is being recorded … … 148 159 } else { 149 160 $spamselect = ""; 150 } 151 $col_count = 0; 152 $top_ten = unserialize($wassup_settings['wassup_top10']); 153 //#get top 10 searches... 161 } 162 ?> 163 <style type="text/css">.top10 { color: #542; }</style> 164 <div id="toptenchart"> 165 <table width="100%" border=0> 166 <tr valign="top"> 167 <?php 168 //#output top 10 searches 154 169 if ($top_ten['topsearch'] == 1) { 155 $ch_search = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND search!='' $spamselect GROUP BY search ORDER BY top_search DESC LIMIT 10"); 156 $col_count = $col_count+1; 157 } 158 //#get top 10 requests... 159 if ($top_ten['toprequest'] == 1) { 160 $ch_urlreq = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND urlrequested!='' $spamselect GROUP BY REPLACE(urlrequested, '/', '') ORDER BY top_urlrequested DESC LIMIT 10"); 161 $col_count = $col_count+1; 162 } 163 //#get top 200 referrers...will be narrowed down to 10 170 $top_results = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND search!='' $spamselect GROUP BY search ORDER BY top_search DESC LIMIT 10"); 171 $char_len = round(($max_char_len*.30)+$widthoffset,0); 172 ?> 173 <td style="min-width:<?php echo $char_len; ?>px;"> 174 <ul class="charts"> 175 <li class="chartsT"><?php _e("TOP QUERY", "wassup"); ?></li> 176 <?php 177 foreach ($top_results as $top10) { ?> 178 <li class="charts"><?php echo $top10->top_search.': <a href="'.$top10->referrer.'" target="_BLANK">'.stringShortener(preg_replace('/'.preg_quote($siteurl,'/').'/i', '', $top10->search),$char_len).'</a>'; ?></li> 179 <?php } ?> 180 </ul> 181 </td> 182 <?php 183 } // end if topsearch 184 185 //#output top 10 referrers 186 //# select top 200 referrers: will be narrowed down to 10 164 187 //# with exclusion of wpurl referrals... 165 188 if ($top_ten['topreferrer'] == 1) { 166 $ch_referer = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND referrer!='' AND referrer NOT LIKE '%".$sitedomain."%' AND searchengine='' $spamselect GROUP BY referrer ORDER BY top_referrer DESC LIMIT 200"); 167 $col_count = $col_count+1; 168 } 169 //#get top 10 browsers... 170 if ($top_ten['topbrowser'] == 1) { 171 $ch_browser = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND browser!='' AND browser NOT LIKE '%N/A%' $spamselect GROUP BY browser ORDER BY top_browser DESC LIMIT 10"); 172 $col_count = $col_count+1; 173 } 174 //#get top 10 operating systems... 175 if ($top_ten['topos'] == 1) { 176 $ch_os = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND os!='' AND os NOT LIKE '%N/A%' $spamselect GROUP BY os ORDER BY top_os DESC LIMIT 10"); 177 $col_count = $col_count+1; 178 } 179 180 //#add an extra width offset when number of columns < 5 181 if ($col_count > 0 && $col_count < 5 ) { 182 $widthoffset = (($max_char_len*(5 - $col_count))/$col_count)*.4; //just a guess 183 } else { 184 $widthoffset = 0; 185 } 186 ?> 187 <div id="toptenchart"> 188 <table width="100%" border=0> 189 <tr valign="top"> 190 <?php if ($top_ten['topsearch'] == 1) { ?> 191 <td><ul class="charts"> 192 <li class="chartsT"><?php _e("TOP QUERY", "wassup") ?></li> 193 <?php 194 $char_len = round(($max_char_len*.30)+$widthoffset,0); 195 foreach ($ch_search as $chS) { 196 print '<li class="charts">'.$chS->top_search.': <a href="'.$chS->referrer.'" target="_BLANK">'.stringShortener(preg_replace('/'.preg_quote($siteurl,'/').'/i', '', $chS->search),$char_len).'</a></li>'."\n"; 197 } ?> 198 </ul> 199 </td> 200 <?php } 201 if ($top_ten['topreferrer'] == 1) { ?> 202 <td><ul class="charts"> 203 <li class="chartsT"><?php _e("TOP REFERER", "wassup") ?></li> 204 <?php 205 $char_len = round(($max_char_len*.22)+$widthoffset,0); 189 $top_results = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND referrer!='' AND referrer NOT LIKE '%".$sitedomain."%' AND searchengine='' $spamselect GROUP BY referrer ORDER BY top_referrer DESC LIMIT 200"); 190 $char_len = round(($max_char_len*.22)+$widthoffset,0); 191 ?> 192 <td style="min-width:<?php echo $char_len; ?>px;"> 193 <ul class="charts"> 194 <li class="chartsT"><?php _e("TOP REFERRER", "wassup"); ?></li> 195 <?php 206 196 $rec_count=0; //# of referrer records output... 207 foreach ($ ch_referer as $chR) {197 foreach ($top_results as $top10) { 208 198 if ($rec_count < 10) { //limits output to 10... 209 199 //# exclude $wpurl from search results... 210 200 //# ...$siteurl already excluded in db query. 211 if ($wpurl == $siteurl || !eregi($wpurl,$ chR->referrer)) {212 print '<li class="charts">'.$chR->top_referrer.': ';213 print '<a href="'.$ chR->referrer.'" title="'.$chR->referrer.'" target="_BLANK">';201 if ($wpurl == $siteurl || !eregi($wpurl,$top10->referrer)) { ?> 202 <li class="charts"><?php echo $top10->top_referrer.': '; 203 print '<a href="'.$top10->referrer.'" title="'.$top10->referrer.'" target="_BLANK">'; 214 204 //#cut http:// from displayed url, then truncate 215 205 //# instead of using stringShortener... 216 print substr(eregi_replace("http://", "", attribute_escape($ chR->referrer)),0,$char_len);217 if (strlen($ chR->referrer) > ($char_len + 7)) {206 print substr(eregi_replace("http://", "", attribute_escape($top10->referrer)),0,$char_len); 207 if (strlen($top10->referrer) > ($char_len + 7)) { 218 208 print '...'; 219 209 } 220 print '</a></li>'."\n"; 210 print '</a>'; ?></li> 211 <?php 221 212 $rec_count=$rec_count+1; 222 213 } //end if !wpurl 223 214 } //end if rec_count 224 } ?>215 } //end foreach ?> 225 216 </ul> 226 217 </td> 227 <?php } 228 if ($top_ten['toprequest'] == 1) { ?> 229 <td><ul class="charts"> 230 <li class="chartsT"><?php _e("TOP REQUEST", "wassup") ?></li> 231 <?php 232 $char_len = round(($max_char_len*.28)+$widthoffset,0); 233 foreach ($ch_urlreq as $chU) { 234 print '<li class="charts">'.$chU->top_urlrequested.': '; 235 print '<a href="'.wAddSiteurl(htmlspecialchars(html_entity_decode($chU->urlrequested))).'" title="'.html_entity_decode($chU->urlrequested).'" target="_BLANK">'; 236 print stringShortener(urlencode(html_entity_decode($chU->urlrequested)),$char_len).'</a></li>'."\n"; 237 } ?> 238 </ul> 239 </td> 240 <?php } 241 if ($top_ten['topbrowser'] == 1) { ?> 242 <td><ul class="charts"> 218 <?php 219 } //end if topreferrer 220 221 //#output top 10 url requests 222 if ($top_ten['toprequest'] == 1) { 223 $top_results = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND urlrequested!='' $spamselect GROUP BY REPLACE(urlrequested, '/', '') ORDER BY top_urlrequested DESC LIMIT 10"); 224 $char_len = round(($max_char_len*.28)+$widthoffset,0); 225 ?> 226 <td style="min-width:<?php echo $char_len; ?>px;"> 227 <ul class="charts"> 228 <li class="chartsT"><?php _e("TOP REQUEST", "wassup"); ?></li> 229 <?php 230 foreach ($top_results as $top10) { ?> 231 <li class="charts"><?php echo $top10->top_urlrequested.': '; 232 print '<a href="'.wAddSiteurl(htmlspecialchars(html_entity_decode($top10->urlrequested))).'" title="'.html_entity_decode($top10->urlrequested).'" target="_BLANK">'; 233 print stringShortener(urlencode(html_entity_decode($top10->urlrequested)),$char_len).'</a>'; ?></li> 234 <?php } ?> 235 </ul> 236 </td> 237 <?php 238 } //end if toprequest 239 240 //#get top 10 browsers... 241 if ($top_ten['topbrowser'] == 1) { 242 $top_results = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND browser!='' AND browser NOT LIKE '%N/A%' $spamselect GROUP BY browser ORDER BY top_browser DESC LIMIT 10"); 243 $char_len = round(($max_char_len*.17)+$widthoffset,0); 244 ?> 245 <td style="min-width:<?php echo $char_len; ?>px;"> 246 <ul class="charts"> 243 247 <li class="chartsT"><?php _e("TOP BROWSER", "wassup") ?></li> 244 248 <?php 245 $char_len = round(($max_char_len*.17)+$widthoffset,0); 246 foreach ($ch_browser as $chB) { 247 print '<li class="charts"><span title="'.$chB->browser.'">'; 248 print $chB->top_browser.': '.stringShortener($chB->browser, $char_len); 249 print '</span></li>'."\n"; 250 } ?> 251 </ul> 252 </td> 253 <?php } 254 if ($top_ten['topos'] == 1) { ?> 255 <td><ul class="charts"> 249 foreach ($top_results as $top10) { ?> 250 <li class="charts"><?php echo $top10->top_browser.': '; 251 echo '<span class="top10" title="'.$top10->browser.'">'.stringShortener($top10->browser, $char_len).'</span>'; ?> 252 </li> 253 <?php } ?> 254 </ul> 255 </td> 256 <?php } //end if topbrowser 257 258 //#output top 10 operating systems... 259 if ($top_ten['topos'] == 1) { 260 $top_results = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND os!='' AND os NOT LIKE '%N/A%' $spamselect GROUP BY os ORDER BY top_os DESC LIMIT 10"); 261 $char_len = round(($max_char_len*.15)+$widthoffset,0); 262 263 ?> 264 <td style="min-width:<?php echo $char_len; ?>px;"> 265 <ul class="charts"> 256 266 <li class="chartsT"><?php _e("TOP OS", "wassup") ?></li> 257 267 <?php 258 $char_len = round(($max_char_len*.15)+$widthoffset,0); 259 foreach ($ch_os as $chO) { 260 print '<li class="charts"><span title="'.$chO->os.'">'; 261 print $chO->top_os.': '.stringShortener($chO->os, $char_len); 262 print '</span></li>'."\n"; 263 } ?> 264 </ul> 265 </td> 266 <?php } ?> 268 foreach ($top_results as $top10) { ?> 269 <li class="charts"><?php print $top10->top_os.': '; ?> 270 <span class="top10" title="<?php echo $top10->os; ?>"><?php echo stringShortener($top10->os, $char_len); ?></span> 271 </li> 272 <?php } ?> 273 </ul> 274 </td> 275 <?php } // end if topos 276 277 //#output top 10 locales/geographic regions... 278 if ($top_ten['toplocale'] == 1) { 279 $top_results = $wpdb->get_results("SELECT count(UPPER(language)) as top_locale, UPPER(language) as locale FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND language!='' AND language NOT LIKE '%N/A%' $spamselect GROUP BY locale ORDER BY top_locale DESC LIMIT 10"); 280 $char_len = round(($max_char_len*.15)+$widthoffset,0); 281 282 ?> 283 <td style="min-width:<?php echo $char_len; ?>px;"> 284 <ul class="charts"> 285 <li class="chartsT"><?php _e("TOP LOCALE", "wassup"); ?></li> 286 <?php 287 foreach ($top_results as $top10) { ?> 288 <li class="charts"><?php echo $top10->top_locale.': '; 289 echo '<img src="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/flags/'.strtolower($top10->locale).'.png" alt="" />'; ?> 290 <span class="top10" title="<?php echo $top10->locale; ?>"><?php echo $top10->locale; ?></span> 291 </li> 292 <?php } ?> 293 </ul> 294 </td> 295 <?php } // end if toplocale 296 ?> 267 297 </tr> 268 298 </table> -
trunk/lib/settings.php
r124 r131 116 116 <input type="checkbox" name="topbrowser" value="1" <?php if($top_ten['topbrowser'] == 1) print "CHECKED"; ?> /><?php _e("Top Browsers", "wassup"); ?> <br /> 117 117 <input type="checkbox" name="topos" value="1" <?php if($top_ten['topos'] == 1) print "CHECKED"; ?> /><?php _e("Top OS", "wassup"); ?> <br /> 118 <input type="checkbox" name="toplocale" value="1" DISABLED /><span style="color:#555;"><?php _e("Top Locales", "wassup"); ?></span><br />118 <input type="checkbox" name="toplocale" value="1" <?php if($top_ten['topos'] == 1) print "CHECKED"; ?> /><?php _e("Top Locales", "wassup"); ?></span><br /> 119 119 </div> 120 120 <div style="display:block; vertical-align:top; float:left; width:225px; color:#555;"> -
trunk/lib/wassup.class.php
r124 r131 36 36 var $wassup_remind_flag; 37 37 var $wassup_uninstall; //for complete uninstall of wassup 38 var $wassup_optimize; // new -for optimize table once a day38 var $wassup_optimize; //for optimize table once a day 39 39 40 40 /* chart display settings */ … … 61 61 var $wmark; 62 62 var $wip; 63 var $whash = ""; //new - wp_hash value used by action.php 63 64 64 65 /* Constructor */ … … 108 109 $this->wassup_uninstall = "0"; 109 110 $this->wassup_optimize = wassup_get_time(); 110 //$this->wassup_top10 = array("1","1","1","1","1","0","0","0","0","0");111 111 $this->wassup_top10 = serialize(array("topsearch"=>"1", 112 112 "topreferrer"=>"1", … … 118 118 "topcrawler"=>"0", 119 119 "topvisitor"=>"0")); 120 $this->whash = $this->get_wp_hash(); 120 121 } 121 122 … … 293 294 } 294 295 296 //#Set a wp_hash value and return it 297 function get_wp_hash($hashkey="") { 298 $wassuphash = ""; 299 if (function_exists('wp_hash')) { 300 if (empty($hashkey)) { 301 if (defined('SECRET_KEY')) { 302 $hashkey = SECRET_KEY; 303 } else { 304 $hashkey = "wassup"; 305 } 306 } 307 $wassuphash = wp_hash($hashkey); 308 } 309 return $wassuphash; 310 } //end function get_wp_hash 311 295 312 //#show a system message in Wassup Admin menus 296 313 function showMessage($message="") { -
trunk/wassup.php
r130 r131 21 21 require_once(dirname(__FILE__).'/lib/wassup.class.php'); 22 22 require_once(dirname(__FILE__).'/lib/main.php'); 23 $wpurl = get_bloginfo('wpurl'); 23 $wpurl = get_bloginfo('wpurl'); //global 24 24 25 25 if (isset($_GET['export'])) { … … 41 41 add_action('admin_menu', 'wassup_add_pages'); 42 42 add_action('send_headers', 'wassupAppend'); 43 //add_action('activity_box_end', 'wassupDashChart');43 add_action('activity_box_end', 'wassupDashChart'); 44 44 } 45 45 … … 52 52 $wassup_options = new wassupOptions; //#settings initialized here 53 53 54 // Add timestamp to optimize table once a day 54 //# set hash 55 $whash = $wassup_options->get_wp_hash(); 56 if (!empty($whash)) { 57 $wassup_options->whash = $whash; 58 } 59 //# Add timestamp to optimize table once a day 55 60 $wassup_options->wassup_optimize = wassup_get_time(); 56 // 57 //### For upgrade of Wassup, manually initialize any new settings 61 62 //# set wmark and wip to null 63 $wassup_options->wmark = 0; //#no preservation of delete/mark 64 $wassup_options->wip = null; 65 66 //### For upgrade of Wassup, manually initialize new settings 58 67 //# initialize settings for 'spamcheck', 'refspam', and 'spam' 59 68 if (!isset($wassup_options->wassup_spamcheck)) { … … 68 77 } 69 78 //# update wassup settings for 'savepath' (default is null) 79 //$wassup_options->wassup_savepath = "/fakedirectory"; //#debug 70 80 if (!isset($wassup_options->wassup_savepath)) { 71 81 $wassup_options->wassup_savepath = null; … … 75 85 $wassup_options->wassup_chart = 1; 76 86 } 77 //# set wmark, and wip to null 78 $wassup_options->wmark = 0; //#no preservation of delete/mark 79 $wassup_options->wip = null; 80 81 //$wassup_options->wassup_savepath = "/fakedirectory"; //#debug 87 //# assign top ten items for upgrades from 1.4.9 or less 88 if (empty($wassup_options->wassup_top10)) { 89 $wassup_options->wassup_top10 = serialize(array("topsearch"=>"1", 90 "topreferrer"=>"1", 91 "toprequest"=>"1", 92 "topbrowser"=>"1", 93 "topos"=>"1", 94 "toplocale"=>"0", 95 "topfeed"=>"0", 96 "topcrawler"=>"0", 97 "topvisitor"=>"0")); 98 } 82 99 $wassup_options->saveSettings(); 83 100 … … 95 112 } 96 113 $wassup_options->saveSettings(); 97 } 114 } 115 unset($sessionpath); //because "install" works in global scope 116 98 117 //# TODO: 99 118 //###Detect known incompatible plugins like "wp_cache" and disable 100 119 //# recordings and show warning message... 101 120 102 //### Create wassup TMP table103 $table_tmp_name = $wpdb->prefix . "wassup_tmp";104 if ($wpdb->get_var("SHOW TABLES LIKE '$table_tmp_name'") != $table_tmp_name) {105 CreateTable("wassup_tmp");106 }107 121 //### Create/upgrade wassup MAIN table 108 122 $table_name = $wpdb->prefix . "wassup"; 109 123 if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { 110 124 CreateTable("wassup"); 125 CreateTable("wassup_tmp"); 111 126 } else { 112 UpdateTable(); 127 UpdateTable(); //<== wassup_tmp is added here, if missing 113 128 } 114 129 } //#end function wassup_install 115 130 131 //set global variables that are dependent on Wassup's wp_options values 116 132 $wassup_settings = get_option('wassup_settings'); //temp only.. 117 133 $wassup_options = new wassupOptions; 118 134 //$wassup_options->loadSettings(); //done automatically 135 $whash = $wassup_options->whash; //global... 119 136 120 137 //#Completely remove all wassup tables and options from Wordpress when … … 172 189 //Add the wassup stylesheet and other javascripts... 173 190 function add_wassup_css() { 174 global $wpurl, $wassup_options; 175 176 //'wp_hash' is not available until all plugins are loaded 177 if (function_exists('wp_hash')) { 178 if (defined('SECRET_KEY')) { $whash = wp_hash(SECRET_KEY); } 179 else { $whash = wp_hash('wassup'); } 180 } else { 181 $whash = ""; 191 global $wpurl, $wassup_options, $whash; 192 193 //assign a value to whash, if none 194 if ($whash == "") { 195 $whash = $wassup_options->get_wp_hash(); 196 $wassup_options->whash = $whash; //save new hash 197 $wassup_options->saveSettings(); 182 198 } 183 199 … … 255 271 var id = $(this).attr('id'); 256 272 $.ajax({ 257 url: "<?php echo $wpurl ; ?>/wp-content/plugins/<?php echo WASSUPFOLDER; ?>/lib/action.php?action=delete&whash=<?php echo$whash; ?>&id=" + id,273 url: "<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/lib/action.php?action=delete&whash='.$whash; ?>&id=" + id, 258 274 async: false 259 275 }) … … 384 400 global $wpdb, $version, $wpurl, $wassup_options, $whash; 385 401 402 //#debug... 403 //error_reporting(E_ALL); //debug 404 //ini_set('display_errors','On'); //debug 405 386 406 //assign a value to whash, if none 387 if (function_exists('wp_hash') && $whash == "") { 388 if (defined('SECRET_KEY')) { 389 $whash = wp_hash(SECRET_KEY); 390 } else { 391 $whash = wp_hash('wassup'); 392 } 393 } 407 //if ($whash == "") { 408 // $whash = $wassup_options->get_wp_hash(); 409 // $wassup_options->whash = $whash; //save new whash
