diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e1850648 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +favicon.* +.htconfig.php +\#* +*.log +*.out +*.version* +favicon.* +*~ + +#ignore reports, should be generted with every build +report/ + +#ignore config files from eclipse, we don't want IDE files in our repository +.project +.buildpath +.externalToolBuilders +.settings +#ignore OSX .DS_Store files +.DS_Store + +/nbproject/private/ + +#ignore smarty cache +/view/smarty3/compiled/ \ No newline at end of file diff --git a/curweather.tgz b/curweather.tgz new file mode 100644 index 00000000..76e0646c Binary files /dev/null and b/curweather.tgz differ diff --git a/curweather/curweather.css b/curweather/curweather.css new file mode 100644 index 00000000..6c127963 --- /dev/null +++ b/curweather/curweather.css @@ -0,0 +1,10 @@ + +#curtemp-settings-label, #curtemp-location-label, #curtemp-enable-label { + float: left; + width: 200px; + margin-bottom: 25px; +} +#curtemp-network { + float: left; +} + diff --git a/curweather/curweather.php b/curweather/curweather.php new file mode 100644 index 00000000..c935eb57 --- /dev/null +++ b/curweather/curweather.php @@ -0,0 +1,108 @@ + Find the location code for the station or airport nearest you here. + * Version: 1.0 + * Author: Tony Baldwin + * Author: Fabio Comuni + * + */ +require_once('addon/curweather/getweather.php'); + +function curweather_install() { + register_hook('network_mod_init', 'addon/curweather/curweather.php', 'curweather_network_mod_init'); + register_hook('plugin_settings', 'addon/curweather/curweather.php', 'curweather_plugin_settings'); + register_hook('plugin_settings_post', 'addon/curweather/curweather.php', 'curweather_plugin_settings_post'); + +} + +function curweather_uninstall() { + unregister_hook('network_mod_init', 'addon/curweather/curweather.php', 'curweather_network_mod_init'); + unregister_hook('plugin_settings', 'addon/curweather/curweather.php', 'curweather_plugin_settings'); + unregister_hook('plugin_settings_post', 'addon/curweather/curweather.php', 'curweather_plugin_settings_post'); + +} + + +function curweather_network_mod_init(&$fk_app,&$b) { + + if(! intval(get_pconfig(local_user(),'curweather','curweather_enable'))) + return; + + $fk_app->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 + $rpt = get_pconfig(local_user(), 'curweather', 'curweather_loc'); + $wxdata = GetWeather::get($rpt); + $temp = $wxdata['TEMPERATURE_STRING']; + $weather = $wxdata['WEATHER']; + $rhumid = $wxdata['RELATIVE_HUMIDITY']; + $pressure = $wxdata['PRESSURE_STRING']; + $wind = $wxdata['WIND_STRING']; + $curweather = '
+
+

'.t("Current Weather").'

'; + + $curweather .= "Weather: $weather
+ Temperature: $temp
+ Relative Humidity: $rhumid
+ Pressure: $pressure
+ Wind: $wind"; + + $curweather .= '
'; + + $fk_app->page['aside'] = $curweather.$fk_app->page['aside']; + +} + + +function curweather_plugin_settings_post($a,$post) { + if(! local_user() || (! x($_POST,'curweather-settings-submit'))) + return; + set_pconfig(local_user(),'curweather','curweather_loc',trim($_POST['curweather_loc'])); + set_pconfig(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable'])); + + info( t('Current Weather settings updated.') . EOL); +} + + +function curweather_plugin_settings(&$a,&$s) { + + if(! local_user()) + return; + + /* Add our stylesheet to the curweather so we can make our settings look nice */ + + $a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variable */ + + $curweather_loc = get_pconfig(local_user(), 'curweather', 'curweather_loc'); + $enable = intval(get_pconfig(local_user(),'curweather','curweather_enable')); + $enable_checked = (($enable) ? ' checked="checked" ' : ''); + + + /* Add some HTML to the existing form */ + + $s .= '
'; + $s .= '

' . t('Current Weather Settings') . '

'; + $s .= '
'; + $s .= '

Find the location code for the airport/weather station nearest you here.

'; + $s .= ''; + $s .= ''; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + + /* provide a submit button */ + + $s .= '
'; + +} + + diff --git a/curweather/getweather.php b/curweather/getweather.php new file mode 100644 index 00000000..b4660b9e --- /dev/null +++ b/curweather/getweather.php @@ -0,0 +1,230 @@ +$i){ + $a=explode(" | ",$i); + if(is_numeric(array_search($wx,$a))){ + self::$wxdata['ICON']="$imgpath/$k.jpg"; + break; + } + } + + // Replace any null elements with "Not available" + foreach(array_keys(self::$wxdata) as $key){ + self::$wxdata[$key]=self::$wxdata[$key]=="NULL"?"Not available":self::$wxdata[$key]; + } + + // If we got humidity + if(is_numeric(self::$wxdata['RELATIVE_HUMIDITY'])) + // Append a percent sign + self::$wxdata['RELATIVE_HUMIDITY'].="%"; + + // Do some formatting to make the output a little friendlier + if(self::$wxdata['VISIBILITY_MI']=="NA") + self::$wxdata['VISIBILITY']="Not available"; + if(self::$wxdata['VISIBILITY']!="Not available") + self::$wxdata['VISIBILITY']=(1*self::$wxdata['VISIBILITY_MI'])." miles"; + + // If we got wind data + if(is_numeric(self::$wxdata['WIND_MPH'])){ + // We're going to output wind data as both MPH from a cardinal direction + // and as Knots from a direction in degrees + + // Calculate the value for Knots + self::$wxdata['WIND_KNOTS']=self::$wxdata['WIND_MPH']/1.15; + + // Format the output + $wind=sprintf("From the %s at %d mph (%03.0f° at %d knots)",self::$wxdata['WIND_DIR'],self::$wxdata['WIND_MPH'],self::$wxdata['WIND_DEGREES'],self::$wxdata['WIND_KNOTS']); + + // If we got a value for wind gusts + if(is_numeric(self::$wxdata['WIND_GUST_MPH']) && self::$wxdata['WIND_GUST_MPH']>0){ + // add it into the wind string + $wind=str_replace("mph","gusting to ".self::$wxdata['WIND_GUST_MPH']." mph
", $wind); + $knots=sprintf("%d",self::$wxdata['WIND_GUST_MPH']/1.15); + $wind=str_replace("knots","gusting to $knots knots",$wind); + } + } else { + // Otherwise, if wind is zero, we'll show "Calm" + $wind=self::$wxdata['WIND_MPH']=="Not available"?"Not available":"Calm"; + } // Done with wind + self::$wxdata['WIND_STRING']=$wind; + + } // Done getting and formatting the data + return self::$wxdata; + } + + function startElement($parser, $name, $attrs) { + self::$itemname=$name; + self::$itemdata=""; + } + + function endElement($parser, $name) { + self::$wxdata[self::$itemname]=self::$itemdata; + self::$itemdata=""; + } + + function characterData($parser, $data) { + self::$itemdata.=$data; + } + + function defineIcons(){ + // See http://weather.gov/data/current_obs/weather.php for source data for this function + $retVal['bkn']="Mostly Cloudy | Mostly Cloudy with Haze | Mostly Cloudy and Breezy"; + $retVal['skc']="Fair | Clear | Fair with Haze | Clear with Haze | Fair and Breezy | Clear and Breezy"; + $retVal['few']="A Few Clouds | A Few Clouds with Haze | A Few Clouds and Breezy"; + $retVal['sct']="Partly Cloudy | Party Cloudy with Haze | Partly Cloudy and Breezy"; + $retVal['ovc']="Overcast | Overcast with Haze | Overcast and Breezy"; + $retVal['nfg']="Fog/Mist | Fog | Freezing Fog | Shallow Fog | Partial Fog | Patches of Fog | Fog in Vicinity | Freezing Fog in Vicinity | Shallow Fog in Vicinity | Partial Fog in Vicinity | Patches of Fog in Vicinity | Showers in Vicinity Fog | Light Freezing Fog | Heavy Freezing Fog"; + $retVal['smoke']="Smoke"; + $retVal['fzra']="Freezing Rain | Freezing Drizzle | Light Freezing Rain | Light Freezing Drizzle | Heavy Freezing Rain | Heavy Freezing Drizzle | Freezing Rain in Vicinity | Freezing Drizzle in Vicinity"; + $retVal['ip']="Ice Pellets | Light Ice Pellets | Heavy Ice Pellets | Ice Pellets in Vicinity | Showers Ice Pellets | Thunderstorm Ice Pellets | Ice Crystals | Hail | Small Hail/Snow Pellets | Light Small Hail/Snow Pellets | Heavy Small Hail/Snow Pellets | Showers Hail | Hail Showers"; + $retVal['mix']="Freezing Rain Snow | Light Freezing Rain Snow | Heavy Freezing Rain Snow | Freezing Drizzle Snow | Light Freezing Drizzle Snow | Heavy Freezing Drizzle Snow | Snow Freezing Rain| Light Snow Freezing Rain | Heavy Snow Freezing Rain | Snow Freezing Drizzle | Light Snow Freezing Drizzle | Heavy Snow Freezing Drizzle"; + $retVal['raip']="Rain Ice Pellets | Light Rain Ice Pellets | Heavy Rain Ice Pellets | Drizzle Ice Pellets | Light Drizzle Ice Pellets | Heavy Drizzle Ice Pellets | Ice Pellets Rain | Light Ice Pellets Rain | Heavy Ice Pellets Rain | Ice Pellets Drizzle | Light Ice Pellets Drizzle | Heavy Ice Pellets Drizzle"; + $retVal['rasn']="Rain Snow | Light Rain Snow | Heavy Rain Snow | Snow Rain | Light Snow Rain | Heavy Snow Rain | Drizzle Snow | Light Drizzle Snow | Heavy Drizzle Snow | Snow Drizzle | Light Snow Drizzle | Heavy Snow Drizzle"; + $retVal['shra']="Rain Showers | Light Rain Showers | Heavy Rain Showers | Rain Showers in Vicinity | Light Showers Rain | Heavy Showers Rain | Showers Rain | Showers Rain in Vicinity | Rain Showers Fog/Mist | Light Rain Showers Fog/Mist | Heavy Rain Showers Fog/Mist | Rain Showers in Vicinity Fog/Mist | Light Showers Rain Fog/Mist | Heavy Showers Rain Fog/Mist | Showers Rain Fog/Mist | Showers Rain in Vicinity Fog/Mist"; + $retVal['tsra']="Thunderstorm | Light Thunderstorm Rain | Heavy Thunderstorm Rain | Thunderstorm Rain Fog/Mist | Light Thunderstorm Rain Fog/Mist | Heavy Thunderstorm Rain Fog/Mist | Thunderstorm Showers in Vicinity | | Light Thunderstorm Rain Haze | Heavy Thunderstorm Rain Haze | Thunderstorm Fog | Light Thunderstorm Rain Fog | Heavy Thunderstorm Rain Fog | Thunderstorm Light Rain | Thunderstorm Heavy Rain | Thunderstorm Rain Fog/Mist | Thunderstorm Light Rain Fog/Mist | Thunderstorm Heavy Rain Fog/Mist | Thunderstorm in Vicinity Fog/Mist | Thunderstorm Showers in Vicinity | Thunderstorm in Vicinity | Thunderstorm in Vicinity Haze | Thunderstorm Haze in Vicinity | Thunderstorm Light Rain Haze | Thunderstorm Heavy Rain Haze | Thunderstorm Fog | Thunderstorm Light Rain Fog | Thunderstorm Heavy Rain Fog | Thunderstorm Hail | Light Thunderstorm Rain Hail | Heavy Thunderstorm Rain Hail | Thunderstorm Rain Hail Fog/Mist | Light Thunderstorm Rain Hail Fog/Mist | Heavy Thunderstorm Rain Hail Fog/Mist | Thunderstorm Showers in Vicinity Hail | | Light Thunderstorm Rain Hail Haze | Heavy Thunderstorm Rain Hail Haze | Thunderstorm Hail Fog | Light Thunderstorm Rain Hail Fog | Heavy Thunderstorm Rain Hail Fog | Thunderstorm Light Rain Hail | Thunderstorm Heavy Rain Hail | Thunderstorm Rain Hail Fog/Mist | Thunderstorm Light Rain Hail Fog/Mist | Thunderstorm Heavy Rain Hail Fog/Mist | Thunderstorm in Vicinity Hail Fog/Mist | Thunderstorm Showers in Vicinity Hail | Thunderstorm in Vicinity Hail | Thunderstorm in Vicinity Hail Haze | Thunderstorm Haze in Vicinity Hail | Thunderstorm Light Rain Hail Haze | Thunderstorm Heavy Rain Hail Haze | Thunderstorm Hail Fog | Thunderstorm Light Rain Hail Fog | Thunderstorm Heavy Rain Hail Fog | Thunderstorm Small Hail/Snow Pellets | Thunderstorm Rain Small Hail/Snow Pellets | Light Thunderstorm Rain Small Hail/Snow Pellets | Heavy Thunderstorm Rain Small Hail/Snow Pellets"; + $retVal['sn']="Snow | Light Snow | Heavy Snow | Snow Showers | Light Snow Showers | Heavy Snow Showers | Showers Snow | Light Showers Snow | Heavy Showers Snow | Snow Fog/Mist | Light Snow Fog/Mist | Heavy Snow Fog/Mist | Snow Showers Fog/Mist | Light Snow Showers Fog/Mist | Heavy Snow Showers Fog/Mist | Showers Snow Fog/Mist | Light Showers Snow Fog/Mist | Heavy Showers Snow Fog/Mist | Snow Fog | Light Snow Fog | Heavy Snow Fog | Snow Showers Fog | Light Snow Showers Fog | Heavy Snow Showers Fog | Showers Snow Fog | Light Showers Snow Fog | Heavy Showers Snow Fog | Showers in Vicinity Snow | Snow Showers in Vicinity | Snow Showers in Vicinity Fog/Mist | Snow Showers in Vicinity Fog | Low Drifting Snow | Blowing Snow | Snow Low Drifting Snow | Snow Blowing Snow | Light Snow Low Drifting Snow | Light Snow Blowing Snow | Heavy Snow Low Drifting Snow | Heavy Snow Blowing Snow | Thunderstorm Snow | Light Thunderstorm Snow | Heavy Thunderstorm Snow | Snow Grains | Light Snow Grains | Heavy Snow Grains | Heavy Blowing Snow | Blowing Snow in Vicinity"; + $retVal['wind']="Windy | Fair and Windy | A Few Clouds and Windy | Partly Cloudy and Windy | Mostly Cloudy and Windy | Overcast and Windy"; + $retVal['hi_shwrs']="Showers in Vicinity | Showers in Vicinity Fog/Mist | Showers in Vicinity Fog | Showers in Vicinity Haze"; + $retVal['fzrara']="Freezing Rain Rain | Light Freezing Rain Rain | Heavy Freezing Rain Rain | Rain Freezing Rain | Light Rain Freezing Rain | Heavy Rain Freezing Rain | Freezing Drizzle Rain | Light Freezing Drizzle Rain | Heavy Freezing Drizzle Rain | Rain Freezing Drizzle | Light Rain Freezing Drizzle | Heavy Rain Freezing Drizzle"; + $retVal['hi_tsra']="Thunderstorm in Vicinity | Thunderstorm in Vicinity Fog/Mist | Thunderstorm in Vicinity Fog | Thunderstorm Haze in Vicinity | Thunderstorm in Vicinity Haze"; + $retVal['ra1']="Light Rain | Drizzle | Light Drizzle | Heavy Drizzle | Light Rain Fog/Mist | Drizzle Fog/Mist | Light Drizzle Fog/Mist | Heavy Drizzle Fog/Mist | Light Rain Fog | Drizzle Fog | Light Drizzle Fog | Heavy Drizzle Fog"; + $retVal['ra']="Rain | Heavy Rain | Rain Fog/Mist | Heavy Rain Fog/Mist | Rain Fog | Heavy Rain Fog"; + $retVal['nsvrtsra']="Funnel Cloud | Funnel Cloud in Vicinity | Tornado/Water Spout"; + $retVal['dust']="Dust | Low Drifting Dust | Blowing Dust | Sand | Blowing Sand | Low Drifting Sand | Dust/Sand Whirls | Dust/Sand Whirls in Vicinity | Dust Storm | Heavy Dust Storm | Dust Storm in Vicinity | Sand Storm | Heavy Sand Storm | Sand Storm in Vicinity"; + $retVal['mist']="Haze"; + return $retVal; + } +// end CLASS +} +?> diff --git a/curweather/test.php b/curweather/test.php new file mode 100644 index 00000000..cd51c23c --- /dev/null +++ b/curweather/test.php @@ -0,0 +1,5 @@ + +* Author: Thomas Willingham */ function forumdirectory_install() { @@ -186,8 +186,6 @@ function forumdirectory_content(&$a) { $arr = array('contact' => $rr, 'entry' => $entry); - call_hooks('directory_item', $arr); - unset($profile); unset($location); diff --git a/geonames.tgz b/geonames.tgz index 952a7602..68b78861 100644 Binary files a/geonames.tgz and b/geonames.tgz differ diff --git a/mahjongg.tar b/mahjongg.tar new file mode 100644 index 00000000..56d70515 Binary files /dev/null and b/mahjongg.tar differ diff --git a/mahjongg/mahjongg.php b/mahjongg/mahjongg.php new file mode 100755 index 00000000..977c693d --- /dev/null +++ b/mahjongg/mahjongg.php @@ -0,0 +1,42 @@ +Mahjongg'; +} + + +function mahjongg_module() {} + +function mahjongg_content(&$a) { + +$baseurl = $a->get_baseurl() . '/addon/mahjongg'; + +$o .= <<< EOT +

+

+ +

+Simply locate the matching tiles and find a way to clear them from the board as quickly as possible. +A timer at the top of the screen keeps track of how you are doing.
+

+EOT; + +return $o; +} diff --git a/mahjongg/mahjongg.swf b/mahjongg/mahjongg.swf new file mode 100755 index 00000000..79f8c9e3 Binary files /dev/null and b/mahjongg/mahjongg.swf differ diff --git a/openstreetmap.tgz b/openstreetmap.tgz index 967b5601..562115c7 100644 Binary files a/openstreetmap.tgz and b/openstreetmap.tgz differ diff --git a/statusnet.tgz b/statusnet.tgz index ea19ef18..da873b17 100755 Binary files a/statusnet.tgz and b/statusnet.tgz differ diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index f3678c80..393bbfe5 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -808,7 +808,8 @@ function statusnet_fetchtimeline($a, $uid) { $items = $connection->get('statuses/user_timeline', $parameters); $posts = array_reverse($items); - foreach ($posts as $post) { + if (count($posts)) { + foreach ($posts as $post) { if ($post->id > $lastid) $lastid = $post->id; @@ -852,7 +853,8 @@ function statusnet_fetchtimeline($a, $uid) { require_once('mod/item.php'); item_post($a); } - } + } + } } set_pconfig($uid, 'statusnet', 'lastid', $lastid); } diff --git a/twitter/twitter.php b/twitter/twitter.php index 0452db60..808768f8 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -615,7 +615,8 @@ function twitter_fetchtimeline($a, $uid) { $items = $connection->get('statuses/user_timeline', $parameters); $posts = array_reverse($items); - foreach ($posts as $post) { + if (count($posts)) { + foreach ($posts as $post) { if ($post->id_str > $lastid) $lastid = $post->id_str; @@ -652,7 +653,8 @@ function twitter_fetchtimeline($a, $uid) { require_once('mod/item.php'); item_post($a); - } + } + } } set_pconfig($uid, 'twitter', 'lastid', $lastid); } diff --git a/viewsrc.tgz b/viewsrc.tgz index 2ace240a..16d587a7 100644 Binary files a/viewsrc.tgz and b/viewsrc.tgz differ diff --git a/viewsrc/viewsrc.php b/viewsrc/viewsrc.php index f165e9c5..9366930f 100644 --- a/viewsrc/viewsrc.php +++ b/viewsrc/viewsrc.php @@ -25,7 +25,9 @@ function viewsrc_page_end(&$a, &$o){ $a->page['htmlhead'] .= <<< EOS EOS;