[mythtv] [PATCH] MythWeb call-by-ref, SIUnits, array check, and config.php patches

Chris Petersen lists at forevermore.net
Sun Nov 14 05:06:56 UTC 2004


committed.  Next time, please use 4-space indentation instead of tabs.

-Chris

IvanK. wrote:
> Chris,
> 
> I'm resending these patches because they must have slipped through unnoticed 
> and I see that cvs from two days ago still exhibits the same problems these 
> patches address.
> 
> I took a look at mythweather and it appears that it expects the value of 
> SIUnuts ot be either YES or NO.  In my patch from yesterday I assumed Yes 
> would be ok.  I've attached a patch to change the Yes to YES.  Apply if you 
> think it's necessary.
> 
> The second patch is for three files that produce call-by-reference warnings.
> 
> The third patch takes care of an object of type Recording being used as array 
> even when it's not.
> 
> The last patch is for config/config.php.
> 
> IvanK.
> 
> 
> ------------------------------------------------------------------------
> 
> --- mythweb-original/recording_schedules.php	2004-09-29 14:15:28.000000000 -0400
> +++ mythweb/recording_schedules.php	2004-09-30 16:30:42.155726153 -0400
> @@ -21,7 +21,10 @@
>          $show = new Recording($record);
>      // Assign a reference to this show to the various arrays
>          $All_Shows[]                 = &$show;
> -        $Channels[$show['chanid']][] = &$show;
> +	if (is_array($show))
> +        	$Channels[$show['chanid']][] = &$show;
> +	else
> +		$Channels[$show->chanid] = &$show;
>          unset($show);
>      }
>  
> 
> 
> ------------------------------------------------------------------------
> 
> --- mythweb-original/program_listing.php	2004-09-30 16:09:10.815479000 -0400
> +++ mythweb/program_listing.php	2004-09-30 16:10:30.666915692 -0400
> @@ -47,5 +47,5 @@
>  // Create an instance of this page from its theme object
>      $Page = new Theme_program_listing;
>  
> -    $Page->print_page(&$Channels, &$Timeslots, $list_starttime, $list_endtime);
> +    $Page->print_page($Channels, $Timeslots, $list_starttime, $list_endtime);
>  ?>
> --- mythweb-original/schedule_manually.php	2004-09-29 14:15:28.000000000 -0400
> +++ mythweb/schedule_manually.php	2004-09-30 16:10:45.734810882 -0400
> @@ -175,7 +175,7 @@
>      $Page = new Theme_schedule_manually();
>  
>  // Display the page
> -    $Page->print_page(&$Channels);
> +    $Page->print_page($Channels);
>  
>  // Exit
>      exit;
>  
> 
> 
> ------------------------------------------------------------------------
> 
> --- mythweb-original/weather.php	2004-09-29 14:15:28.000000000 -0400
> +++ mythweb/weather.php	2004-09-30 17:01:33.259446741 -0400
> @@ -167,7 +167,7 @@
>  	}
>  
>  	//Are we using metric or imperial system
> -	if($this->use_metric == "Yes") {
> +	if($this->use_metric == "YES") {
>  		$this->Temperature = round((5/9) * ($this->Temperature - 32));
>  		$this->Real = round((5/9) * ($this->Real - 32));
>  		$this->BarometricPressure = round($this->BarometricPressure * 2.54);
> @@ -218,7 +218,7 @@
>  	    list($forecast->DescImage,$forecast->DescText) = getImageAndDescFromId($data[15 + $i]);
>  	    $forecast->DescImage = (strlen($forecast->DescImage) > 0) ? $forecast->DescImage : "unknown.png";
>  	    $forecast->DescText = (strlen($forecast->DescText) > 0) ? $forecast->DescText : _LANG_UNKNOWN . " (" . $data[15+$i] . ")";
> -	    if($this->use_metric == "Yes") {
> +	    if($this->use_metric == "YES") {
>  	    	$forecast->HighTemperature = round((5/9) * ($data[20 + $i] - 32));
>  	    	$forecast->LowTemperature = round((5/9) * ($data[40 + $i] -32 ));
>  	    } else {
> --- mythweb-original/themes/Default/weather.php	2004-09-29 14:15:29.000000000 -0400
> +++ mythweb/themes/Default/weather.php	2004-09-30 17:02:27.964829561 -0400
> @@ -23,20 +23,20 @@
>  				<div style="float: left; width: 220px; text-align: center;margin: 1em;padding: 5px;">
>  					<img src="themes/Default/img/weather/<?php echo $site->ConditionImage; ?>" style="behavior: url('<?=theme_dir?>pngbehavior.htc');" />
>  					<p style="font-size: 150%;margin: 0;padding: .3em 0"><?php echo $site->ConditionText; ?></p>
> -					<p style="font-size: 250%;margin: 0;"><?php echo $site->Temperature; ?><span style="vertical-align: text-top;font-size:50%;">O</span><span><?php if($site->use_metric == "Yes") echo " C"; else echo " F"; ?></span></p>
> +					<p style="font-size: 250%;margin: 0;"><?php echo $site->Temperature; ?><span style="vertical-align: text-top;font-size:50%;">O</span><span><?php if($site->use_metric == "YES") echo " C"; else echo " F"; ?></span></p>
>  				</div>
>  
>  				<table border="0" style="width: 300px; margin-top: 1em; line-height: 1.7em;">
>  					<tr>	<td><?php echo _LANG_HUMIDITY; ?></td>
>  						<td style="text-align: right;"><?php echo $site->Humidity; ?>%</td></tr>
>  					<tr>	<td><?php echo _LANG_PRESSURE; ?></td>
> -						<td style="text-align: right;"><?php echo $site->BarometricPressure; if($site->use_metric == "Yes") echo " cm"; else echo " in"; ?> </td></tr>
> +						<td style="text-align: right;"><?php echo $site->BarometricPressure; if($site->use_metric == "YES") echo " cm"; else echo " in"; ?> </td></tr>
>  					<tr>	<td><?php echo _LANG_WIND; ?></td>
> -						<td style="text-align: right;"><?php echo $site->WindDirection . " " . _LANG_AT . " " .  $site->WindSpeed; if($site->use_metric == "Yes") echo " kph"; else echo " mph"; ?></td></tr>
> +						<td style="text-align: right;"><?php echo $site->WindDirection . " " . _LANG_AT . " " .  $site->WindSpeed; if($site->use_metric == "YES") echo " kph"; else echo " mph"; ?></td></tr>
>  					<tr>	<td><?php echo _LANG_VISIBILITY; ?></td>
> -						<td style="text-align: right;"><?php echo $site->Visibility; if($site->use_metric == "Yes") echo " km"; else echo " mi"; ?></td></tr>
> +						<td style="text-align: right;"><?php echo $site->Visibility; if($site->use_metric == "YES") echo " km"; else echo " mi"; ?></td></tr>
>  					<tr>	<td><?php echo _LANG_WIND_CHILL; ?></td>
> -						<td style="text-align: right;"><?php echo $site->Real; if($site->use_metric == "Yes") echo " C"; else echo " F"; ?></td></tr>
> +						<td style="text-align: right;"><?php echo $site->Real; if($site->use_metric == "YES") echo " C"; else echo " F"; ?></td></tr>
>  					<tr>	<td><?php echo _LANG_UV_INDEX; ?></td>
>  						<td style="text-align: right;"><?php echo $site->UV . " (";
>  						if($site->UV < 3) echo _LANG_UV_MINIMAL;
> @@ -88,8 +88,8 @@
>  					<p style="margin:0;padding: .3em 0 .3em 0;font-size: 125%"><?php echo $forecast->DescText; ?></p>
>  					<table style="width: 200px; text-align: center;" border="0">
>  						<tr><th><?php echo _LANG_LOW; ?></th><th><?php echo _LANG_HIGH; ?></th></tr>
> -						<tr><td><p style="font-size: 150%;margin: 0;"><?php echo $forecast->LowTemperature; ?><span style="vertical-align: text-top;font-size: 50%;">O</span><span><?php if($site->use_metric == "Yes") echo " C"; else echo " F"; ?></span></p></td>
> -						<td><p style="font-size: 150%;margin: 0;"><?php echo $forecast->HighTemperature; ?><span style="vertical-align: text-top;font-size: 50%;">O</span><span><?php if($site->use_metric == "Yes") echo " C"; else echo " F"; ?></span></p></td></tr>
> +						<tr><td><p style="font-size: 150%;margin: 0;"><?php echo $forecast->LowTemperature; ?><span style="vertical-align: text-top;font-size: 50%;">O</span><span><?php if($site->use_metric == "YES") echo " C"; else echo " F"; ?></span></p></td>
> +						<td><p style="font-size: 150%;margin: 0;"><?php echo $forecast->HighTemperature; ?><span style="vertical-align: text-top;font-size: 50%;">O</span><span><?php if($site->use_metric == "YES") echo " C"; else echo " F"; ?></span></p></td></tr>
>  					</table>
>  				</div>
>  			<?php	}
> 
> 
> ------------------------------------------------------------------------
> 
> --- mythweb-original/config/conf.php	2004-09-29 14:15:28.000000000 -0400
> +++ mythweb/config/conf.php	2004-09-30 18:13:23.341016515 -0400
> @@ -54,7 +54,7 @@
>  
>  // Type of url for the links to mythmusic files. Filename will be added to the end.
>  // For this to work, create a 'music' symlink in mythweb which points to the path for mythmusic files.
> -    define('music_url', music);
> +    define('music_url', 'music');
>  
>  // Path to the mythvideo "covers" directory
>      define('video_img_path', '');
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


More information about the mythtv-dev mailing list