function getCurrentTime() { $t = $_GET['promlink']; if (empty($t)) { return time(); } else { return parseTime($t); } }
if ($ids[$i] > $upper) { $upper = $ids[$i]; } } } } $data = explode(";", $parts[0]); $lines = false; if (isset($_GET['lns'])) { $lines = array(); foreach ($_GET['lns'] as $t) { $lines[] = parseTime($t); } } $rlow = parseTime("08:00:00") / (1000 * 60 * 60); $rhigh = parseTime("22:00:00") / (1000 * 60 * 60); $pts = array_fill(0, count($data), array()); foreach ($data as $day => $times) { $times = trim($times); if (count($times) == 0) { continue; } $evts = explode(",", $times); foreach ($evts as $str) { if (strlen($str) != 8) { continue; } list($low, $high) = sscanf($str, '%04x%04x'); //echo "$low $high\n"; $pts[$day][] = array(floatval($low) / 60 - $rlow, floatval($high) / 60 - $rlow); }
function BasicSearchWhere() { global $Security, $archives; $sSearchStr = ""; $sSearchKeyword = ew_StripSlashes(@$_GET[EW_TABLE_BASIC_SEARCH]); $sSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE]; $sSearchStartTime = @$_GET[EW_TABLE_BASIC_SEARCH_START_TIME]; $sSearchEndTime = @$_GET[EW_TABLE_BASIC_SEARCH_END_TIME]; $sSearchProjectName = @$_GET[EW_TABLE_BASIC_SEARCH_PROJECTNAME]; if ($sSearchKeyword != "") { $sSearch = trim($sSearchKeyword); if ($sSearchType != "") { while (strpos($sSearch, " ") !== FALSE) { $sSearch = str_replace(" ", " ", $sSearch); } $arKeyword = explode(" ", trim($sSearch)); foreach ($arKeyword as $sKeyword) { if ($sSearchStr != "") { $sSearchStr .= " " . $sSearchType . " "; } $sSearchStr .= "(" . BasicSearchSQL($sKeyword) . ")"; } } else { $sSearchStr = BasicSearchSQL($sSearch); } $sSearchStrTime = parseTime($sSearchStartTime, $sSearchEndTime); if ($sSearchStrTime != "") { if ($sSearchStr != "") { $sSearchStr = '(' . $sSearchStr . ') AND '; } $sSearchStr .= $sSearchStrTime; } $archives->setBasicSearchKeyword($sSearchKeyword); $archives->setBasicSearchType($sSearchType); $archives->setBasicSearchStartTime($sSearchStartTime); $archives->setBasicSearchEndTime($sSearchEndTime); } $sSearchStrProjectName = parseProjectName($sSearchProjectName); if ($sSearchStrProjectName != "") { if ($sSearchStr != "") { $sSearchStr = '(' . $sSearchStr . ') AND '; } $sSearchStr .= $sSearchStrProjectName; } $archives->setBasicSearchProjectName($sSearchProjectName); return $sSearchStr; }
$_SESSION['email_message'] = $html; //get all email addresses $emails = []; $page = 0; while ($stmt = $dbc->query('SELECT email, code FROM `subscribers` ORDER BY id LIMIT ' . $page++ * 50 . ', ' . '50')) { if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { do { $emails[] = ['email' => $row['email'], 'code' => $row['code']]; } while ($row = $stmt->fetch(PDO::FETCH_ASSOC)); } else { break; } } $emails = json_encode($emails); //mailer interface include './views/mailer.html'; } else { $pageTitle = 'Email Creator'; include './includes/header.html'; //on form submit //get all upcoming events $q = 'SELECT id, start_time, end_time, title, venue, DATE_FORMAT(`date`, \'%a. %M %D, %Y\') AS `edate` FROM events WHERE `date`>=CURRENT_DATE() AND `date`<DATE_ADD(CURDATE(), INTERVAL 1 WEEK) ORDER BY `date` ASC, start_time ASC'; $events = array(); $stmt = $dbc->query($q); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $events[] = array('id' => $row['id'], 'time' => parseTime($row['start_time']) . (!empty($row['end_time']) ? '-' . parseTime($row['end_time']) : ''), 'title' => str_replace("'", ''', $row['title']), 'venue' => str_replace("'", ''', $row['venue']), 'date' => $row['edate']); } //display the form include './views/email_form.html'; include './includes/footer.html'; }
if (!$row) { $pageTitle = 'Error'; include './includes/header.html'; echo '<div class="centeredDiv"><h2>This page has been accessed in error</h2></div>'; include './includes/footer.html'; exit; } $r->closeCursor(); //get associated event info if ($r = $dbc->query("SELECT title, events.id, DATE_FORMAT(`date`, '%a. %M %D, %Y') AS edate, start_time, end_time\r\n FROM venues JOIN events_venues ON venues.id=venue_id JOIN events ON events.id=event_id\r\n WHERE venues.id={$row['id']} AND `date` >= CURDATE()\r\n ORDER BY `date` ASC, start_time ASC")) { $events = array(); while ($row2 = $r->fetch(PDO::FETCH_ASSOC)) { $row2['time'] = parseTime($row2['start_time']); //check for end time if (!empty($row2['end_time'])) { $row2['time'] .= ' - ' . parseTime($row2['end_time']); } $events[$row2['edate']][] = $row2; //array of an array of events indexed by date } } //parse the links $linkURL = array(); if (!empty($row['links'])) { $p = explode('|', $row['links']); foreach ($p as $pair) { $l = explode('\\', $pair); $linkURL[$l[0]] = $l[1]; } } //display the view
$mesgid = $row['id']; $smsName = $row['smsName']; $to = $row['category']; $time = parseTime($row['times']); //this should convert it to days echo "<td>" . ++$count . "</td><td>{$smsName}</td><td>{$to}</td><td>{$time}</td><td>"; print substr($mesg, 0, 15) . "..</td>"; echo "<td><a href = \"#\" onClick = \"delQueuedmesg('sheduleMultiple',{$mesgid}); return false;\">del</a></td></tr>"; } while ($row2 = mysql_fetch_array($result2)) { echo "<tr>"; $mesgid = $row2['id']; $mesg = $row2['mesg']; $smsName = $row2['smsName']; $to = $row2['tophone']; $time = parseTime($row2['times']); //this should convert epoch to real date and times echo "<td>" . ++$count . "</td><td>{$smsName}</td><td>{$to}</td><td>{$time}</td><td>"; print substr($mesg, 0, 15) . "..</td>"; echo "<td><a href = \"#\" onClick = \"delQueuedmesg('sheduleSingle',{$mesgid}); return false;\">del</a></td></tr>"; } echo "</table>"; echo "</p>"; echo "</div></div>"; /* echo "<div id = \"success\">"; echo "Entry was Successfuly deleted"; echo "</div> <!-- end success -->"; echo "<div class = \"back\"><a style = \"text-decoration: none;\" href = \"./\" onClick = \"getphoneBook(); return false;\">Refresh PhoneBook</a> | <a style = \"text-decoration: none;\" href = \"./\" onClick = \"getSMSForm(); return false;\">back</a></div>"; */ } else { echo "<div class=\"ui-widget\">";
$linkDesc = array(); foreach ($links as $i => $pair) { $a = explode('\\', $pair); $linkURL[$i] = $a[0]; $linkDesc[$i] = $a[1]; } } //get relevant events info for this profile $events = array(); $q = $dbc->query("SELECT id, DATE_FORMAT(`date`, '%a. %M %D, %Y') AS edate, start_time, end_time, title, venue\r\n FROM events_profiles JOIN events ON event_id=id\r\n WHERE profile_id={$row['user_id']} AND `date` >= CURDATE()\r\n ORDER BY `date` ASC, start_time ASC"); while ($r = $q->fetch(PDO::FETCH_ASSOC)) { //check if event has ending time if (!empty($r['end_time'])) { $r['time'] = parseTime($r['start_time']) . '-' . parseTime($r['end_time']); } else { $r['time'] = parseTime($r['start_time']); } $events[$r['edate']][] = $r; } //get associated secondary instruments $secInstr = array(); $q = 'SELECT instr.name FROM instr JOIN profiles_secondaryinstr ON instr.id=instr_id WHERE profile_id=' . $row['user_id']; $stmt = $dbc->query($q); while ($instrName = $stmt->fetchColumn()) { $secInstr[] = ucwords($instrName); } //display the profile view $pageTitle = $row['name']; include './includes/header.html'; include './views/profile_view.html'; include './includes/footer.html';
function get_rqvar(&$env, $name, $type = false) { if (!isset($env[$name])) { set_status_and_exit(400, "{$name} is a required variable"); } if ($type !== false) { if ($type != "array" && is_array($env[$name])) { set_status_and_exit(400, "{$name} is formatted improperly."); } if ($type == "array" && !is_array($env[$name])) { return array($env[$name]); } if ($type == "integer") { return intval($env[$name]); } if ($type == "float") { return floatval($env[$name]); } if ($type == "time") { return parseTime($env[$name]); } } return $env[$name]; }
protected function _EXCEL_SET($elem) { list($excel, $pos) = $this->getStruct('EXCEL'); $value = $elem[SIGN_CDATA]; ($coords = $elem['COORDS']) === '' || $this->getExcelCoords($excel, $pos, $coords); switch ($type = $elem['TYPE']) { case 'text': $exceltype = \PHPExcel_Cell_DataType::TYPE_STRING; break; case 'bool': $exceltype = \PHPExcel_Cell_DataType::TYPE_BOOL; break; case 'numeric': case 'date': $date = $type === 'date'; if (is_numeric($value) || $date && ($value = parseTime($value)) !== null) { $exceltype = \PHPExcel_Cell_DataType::TYPE_NUMERIC; $date and $value = \PHPExcel_Shared_Date::PHPToExcel($value); break; } case 'null': $exceltype = \PHPExcel_Cell_DataType::TYPE_NULL; $value = ''; break; default: // auto $exceltype = \PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($value); } list($sheet, $row, $col) = $pos; $row++; $sheet = $excel->getSheet($sheet); $sheet->getCellByColumnAndRow($col, $row)->setValueExplicit($value, $exceltype); ($format = $elem['FORMAT']) === null || $sheet->getStyleByColumnAndRow($col, $row)->getNumberFormat()->setFormatCode($format); }
public function getHTML() { //print formatted event info if (!empty($this->end_time)) { echo parseTime($this->start_time) . ' - ' . parseTime($this->end_time) . ': '; } else { echo parseTime($this->start_time) . ': '; } echo '<a href="http://jazzinaustin.com/events.php?id=' . $this->id . '" target="_blank">' . $this->title; echo ' @ ' . $this->venue . '</a>'; }
//var_dump($exploded); $res['directions'] = array(); $bNodes = $resultNode->find('b'); //Direction names are within <b></b> //How much items at the end of the split do we skip ? (useless content) if (count($resultNode->find('span.whiteB')) > 2) { $uselessLines = 2; } else { $uselessLines = 1; } $bNodeSkip = $bNodeIndex; $i = 1; //skipping first element (station + line) while ($i < count($exploded) - $uselessLines && count($bNodes) > $bNodeSkip) { //not entering loop if no direction provided $a_direction['time'] = parseTime($exploded[$i]); while ($bNodeIndex < count($bNodes)) { if (strlen($bNodes[$bNodeIndex]->innertext) > 2) { $a_direction['name'] = substr($bNodes[$bNodeIndex]->innertext, 5); // remove le "Vers: " $bNodeIndex++; break; } $bNodeIndex++; } $i++; array_push($res['directions'], $a_direction); } //output variables if (isset($_GET['json'])) { header("Content-type: application/json");
<?php function parseTime($timestr) { preg_match("/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/", $timestr, $result); return mktime($result[4], $result[5], $result[6], $result[2], $result[3], $result[1]); } require_once "config.php"; mysql_connect($host, $user, $password) or die("Unable to connect to database."); mysql_select_db($database); mysql_query("SET NAMES UTF8"); $sql = "SELECT * FROM contest WHERE finishtime > NOW() ORDER BY startreg ASC"; $query = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($query)) { do { $contest = mysql_fetch_array($query, MYSQL_ASSOC); $contest["starttime"] = parseTime($contest["startreg"]); $contest["endtime"] = parseTime($contest["endreg"]); } while (mysql_num_rows($query) > 1 && $contest["endtime"] < time()); // print_r($contest); } else { $contest = NULL; }