-1 || strpos($awm_name,".js")>-1 ) { $nm = explode("/", $awm_name); $awm_name = $nm[1]; $nm = explode(".", $awm_name); $awm_name = $nm[0]; } return $awm_name; } /* This code checks for updated versions of the AllWebMenus software and informs the user if necessary */ function AWM_check() { global $url, $total_tabs; $the_msg = array(); $realpath = dirname(__FILE__) .'/../../..'. get_option('AWM_menu_path'); $path = get_bloginfo('url') . get_option('AWM_menu_path'); error_reporting(0); for ($t=0; $t<$total_tabs; $t++) { $the_msg[$t] = ""; if (!get_option('AWM_menu_active_'.$t)) continue; $awm_name = trim(get_option('AWM_menu_name_'.$t)).".js"; if (! ($menufile = fopen($realpath . $awm_name, 'r'))) { $the_msg[$t] = "Menu ".get_option('AWM_menu_name_'.$t)." was not found at: ". $path . $awm_name; continue; } elseif (! ($mfile = fread($menufile, filesize($realpath . $awm_name)))) { $the_msg[$t] = "Could not read menu at: ". $path . $awm_name; continue; } $bNo = explode('awmLibraryBuild=', $mfile); if ($bNo[1]==null) { $the_msg[$t] = "Could not read menu at: ". $path . $awm_name; continue; } $bNo = explode(';', $bNo[1]); $buildNo = $bNo[0]; $hNo = explode('awmHash=\'', $mfile); if ($hNo[1]==null) { $the_msg[$t] = "Could not read menu at: ". $path . $awm_name; continue; } $hNo = explode('\'', $hNo[1]); $HashNo = $hNo[0]; $params = "plugin=wordpress&build=$buildNo&hash=$HashNo&rand=". rand(1,10000) ."&domain=". get_bloginfo('url'); if (function_exists('curl_init')) { if (! ($awm_tmp = geturl($params))) { $the_msg[$t] = "Could not retrieve version information for ".get_option('AWM_menu_name_'.$t).". Please contact Likno for more information."; } else { $the_msg[$t] = $awm_tmp; } continue; } else { $the_msg[$t] = ''; } } $has_msg = false; for ($t=0; $t<$total_tabs; $t++) { if ($the_msg[$t] != "") $has_msg = true; break; } $the_full_msg = ""; if ($has_msg) { $the_full_msg = "
"; for ($t=0; $t<$total_tabs; $t++) if ($the_msg[$t] != "") $the_full_msg .= "
Note about ".get_option('AWM_menu_name_'.$t).":
".$the_msg[$t]."
"; $the_full_msg .= "

 
"; } update_option('AWM_Checked', TRUE); update_option('AWM_Checked_Date', date(d)); error_reporting(1); return $the_full_msg; } /* Helper code for above function */ $url="http://www.likno.com/addins/plugin-check.php"; function geturl($params) { global $url; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); return $postResult; } ?>