* */ 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'); register_hook('profile_advanced', 'addon/curtemp/curtemp.php', 'curtemp_profile_advanced'); } 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'); unregister_hook('profile_advanced', 'addon/curtemp/curtemp.php', 'curtemp_profile_advanced'); } 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 = '

'.t("Current Temp").'

'; $curtemp .= ' Weather:
Temperature: '; $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','max_curtemps',intval($_POST['curtemp_max_curtemps'])); 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 .= '
'; $s .= '

' . t('Current Temp Settings') . '

'; $s .= '
'; $s .= ''; $s .= ''; $s .= '
'; $s .= ''; $s .= ''; $s .= '
'; $s .= '
'; /* provide a submit button */ $s .= '
'; }