Пример #1
0
     $limit = '';
 } else {
     $intvals = array(5, 10, 15, 20, 30, 60);
     foreach ($intvals as $val) {
         if ($val == $wdYearLim) {
             $ival = $val;
         }
     }
     if ($datetime_col == 'no') {
         $interval = isset($ival) ? $ival : 15;
     } else {
         $interval = $wdYearLim;
     }
     // create regexp string
     for ($i = 0; $i < 60; $i += $interval) {
         $regstr .= zero_bd($i) . '|';
     }
     $regstr = substr($regstr, 0, -1);
     // remove extra pipe
     $regstr = "'..:({$regstr}):..'";
     $limit = "AND datetime REGEXP {$regstr}";
 }
 switch ($datetime_col) {
     case 'yes':
         $que = "SELECT datetime, {$datacol} FROM {$dbtable} WHERE datetime BETWEEN '{$start}' AND '{$end}' {$limit} AND temperature IS NOT NULL ORDER BY datetime ASC";
         break;
     case 'no':
         $que = "SELECT datetime, {$datacol} FROM(SELECT CONCAT(date,' ',time)as datetime, {$datacol} from {$dbtable}) as temp WHERE datetime BETWEEN '{$start}' AND '{$end}' {$limit} AND temperature IS NOT NULL ORDER BY datetime ASC";
 }
 $sql = mysql_query($que);
 if (!$sql) {
Пример #2
0
     $WUcacheFile2 = $dirCont . '/' . $WUID . '-day-' . $cYear . $cMnth . zero_bd($cDay) . '.txt';
     ## cache file creation
     $opts = array('http' => array('method' => 'GET', 'header' => 'Cookie: Units=' . $unitsLnk));
     $context = stream_context_create($opts);
     // context HEADER with cookie for changing units
     if ($fopenOff) {
         include './fopener.php';
         $read = new HTTPRequest($WUsourceFile2);
         $wsource2 = $read->DownloadToString();
     } else {
         $wsource2 = file_get_contents($WUsourceFile2, 0, $context);
     }
     $ctarget2 = fopen($WUcacheFile2, "w");
     fwrite($ctarget2, $wsource2);
     fclose($ctarget2);
     parse_wu_day($WUcacheFile2, $cYear, $cMnth, zero_bd($cDay), true);
     // for calculation a creation Average baro, solar and wind cache files
     $cpEnd = $cron ? true : false;
     // at once in WU pages and more steps in cron mode given by $cronFiles in WU-precache.php
     $sbl++;
     //echo '<br>copied<br>';
     continue;
 } else {
     $fileExists++;
 }
 // create flag file for completed month
 if ($fileExists == $chckMdays + 1 and !$uncompMonth) {
     $comfil = fopen($dirCont . "/" . $WUID . "-completed.txt", "w");
     fwrite($comfil, "This month is completely cached.");
     fclose($comfil);
 }