* */ function curtemp_install() { register_hook('network_mod_init', 'addon/curtemp/curtemp.php', 'curtemp_network_mod_init'); register_hook('plugin_settings', 'addon/curtemp/curtemp.php', 'curtemp_plugin_settings'); register_hook('plugin_settings_post', 'addon/curtemp/curtemp.php', 'curtemp_plugin_settings_post'); } function curtemp_uninstall() { unregister_hook('network_mod_init', 'addon/curtemp/curtemp.php', 'curtemp_network_mod_init'); unregister_hook('plugin_settings', 'addon/curtemp/curtemp.php', 'curtemp_plugin_settings'); unregister_hook('plugin_settings_post', 'addon/curtemp/curtemp.php', 'curtemp_plugin_settings_post'); } function curtemp_network_mod_init($a,$b) { if(! intval(get_pconfig(local_user(),'curtemp','curtemp_enable'))) return; $a->page['htmlhead'] .= '' . "\r\n"; // the getweather file does all the work here // the $rpt value is needed for location // which getweather uses to fetch the weather data for weather and temp $curtemp_loc = get_pconfig(local_user(), 'curtemp', 'curtemp_loc'); $curtemp = '
'; $a->page['aside'] = $curtemp . $a->page['aside']; } function curtemp_plugin_settings_post($a,$post) { if(! local_user() || (! x($_POST,'curtemp-settings-submit'))) return; set_pconfig(local_user(),'curtemp','curtemp_loc',trim($_POST['curtemp_loc'])); set_pconfig(local_user(),'curtemp','curtemp_enable',intval($_POST['curtemp_enable'])); info( t('Current Temp settings updated.') . EOL); } function curtemp_plugin_settings(&$a,&$s) { if(! local_user()) return; /* Add our stylesheet to the curtemp so we can make our settings look nice */ $a->page['htmlhead'] .= '' . "\r\n"; /* Get the current state of our config variable */ $curtemp_loc = get_pconfig(local_user(), 'curtemp', 'curtemp_loc'); $enable = intval(get_pconfig(local_user(),'curtemp','curtemp_enable')); $enable_checked = (($enable) ? ' checked="checked" ' : ''); /* Add some HTML to the existing form */ $s .= '