/** * Output list of upcoming events for the location. * @since 2.0.0 * @version 2.0.0 * @param integer $limit [optional] Event List Size (Default:5) * @return void */ function location_events($limit = 5) { global $lID, $hc_cfg, $hc_lang_core, $hc_lang_locations; $result = doQuery("SELECT PkID, Title, StartDate, StartTime, EndTime, TBD\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "events \r\n\t\t\t\t\t\t\tWHERE IsActive = 1 AND IsApproved = 1 AND LocID = '" . cIn($lID) . "' AND StartDate >= '" . cIn(SYSDATE) . "'\r\n\t\t\t\t\t\tORDER BY StartDate, TBD, StartTime, Title\r\n\t\t\t\t\t\tLIMIT " . cIn($limit)); if (!hasRows($result)) { echo '<p>' . $hc_lang_locations['NoEvents'] . ' <a href="' . CalRoot . '/index.php?com=submit" rel="nofollow">' . $hc_lang_locations['NoEventsLink'] . '</a></p>'; return 0; } $cnt = $date = 0; while ($row = mysql_fetch_row($result)) { if ($date != $row[2]) { $date = $row[2]; echo $cnt > 0 ? ' </ul>' : ''; echo ' <header>' . stampToDate($row[2], $hc_cfg[14]) . '</header> <ul>'; $cnt = 1; } $hl = $cnt % 2 == 0 ? ' class="hl"' : ''; if ($row[5] == 0) { $time = $row[3] != '' ? stampToDate($row[3], $hc_cfg[23]) : ''; $time .= $row[4] != '' ? ' - ' . stampToDate($row[4], $hc_cfg[23]) : ''; $stamp = date("Y-m-d\\Th:i:00", strtotime($row[2] . trim(' ' . $row[3]))) . HCTZ; } else { $time = $row[5] == 1 ? $hc_lang_locations['AllDay'] : $hc_lang_locations['TBA']; $stamp = date("Y-m-d", strtotime($row[2])); } echo ' <li' . $hl . ' itemscope itemtype="http://schema.org/Event"><time itemprop="startDate" datetime="' . $stamp . '">' . $time . '</time><a itemprop="url" href="' . CalRoot . '/index.php?eID=' . $row[0] . '"><span itemprop="name">' . cOut($row[1]) . '</span></a></li>'; ++$cnt; } echo '</ul>'; }
/** * Verify API user authentication. If invalid terminate execution. * @since 2.2.0 * @version 2.2.0 * @param string $user Username passed to the API via URL argument * @param string $key API Key passed to the API via URL argument * @return void */ function api_user_authenticate($user = '', $key = '') { global $hc_cfg; $valid = 0; $api_users = array(); if (!isset($user) || !isset($key)) { return api_error(2); } if ($hc_cfg[128] == 2) { $api_users_age = apc_exists(HC_APCPrefix . 'users_age') ? apc_fetch(HC_APCPrefix . 'users_age') : 0; if (apc_exists(HC_APCPrefix . 'users')) { $api_users = apc_fetch(HC_APCPrefix . 'users'); } if ($api_users_age <= date("U") && count($api_users) > 0) { apc_user_write_cache($api_users); $api_users = array(); } if (array_key_exists($key, $api_users) && $api_users[$key][1] == $user) { ++$api_users[$key][0]; $count = $api_users[$key]; unset($api_users[$key]); $api_users[$key] = $count; $valid = 1; } else { $result = doQuery("SELECT PkID, NetworkName, APIKey FROM " . HC_TblPrefix . "users WHERE NetworkName = '" . cIn($user) . "' AND APIKey = '" . cIn($key) . "' AND APIAccess = 1 AND IsBanned = 0"); if (hasRows($result)) { $api_users[mysql_result($result, 0, 2)][0] = '1'; $api_users[mysql_result($result, 0, 2)][1] = mysql_result($result, 0, 1); $valid = 1; } } if (count($api_users) > $hc_cfg[130]) { $user_keys = array_keys($api_users); $remove = array_shift($user_keys); $store_cnt = $api_users[$remove][0]; $store_user = $api_users[$remove][1]; doQuery("UPDATE " . HC_TblPrefix . "users SET APICnt = (APICnt + '" . cIn($store_cnt) . "') WHERE APIKey = '" . cIn($remove) . "' AND NetworkName = '" . cIn($store_user) . "'"); array_shift($api_users); } apc_store(HC_APCPrefix . 'users', $api_users); } else { $result = doQuery("SELECT PkID, NetworkName, APIKey FROM " . HC_TblPrefix . "users WHERE NetworkName = '" . cIn($user) . "' AND APIKey = '" . cIn($key) . "' AND APIAccess = 1 AND IsBanned = 0"); if (hasRows($result)) { $valid = 1; doQuery("UPDATE " . HC_TblPrefix . "users SET APICnt = (APICnt + 1) WHERE APIKey = '" . cIn($key) . "' AND NetworkName = '" . cIn($user) . "'"); } } if ($valid == 0) { return api_error(2); } else { return null; } }
/** * Output weekly dashboard to a page outside of Helios Calendar. * @since 2.0.1 * @version 2.0.1 * @param binary $submit include submit event link, 0 = hide , 1 = show (Default:1) * @param binary $ical include iCalendar subscription link, 0 = hide, 1 = show (Default:1) * @param binary $rss include All Events rss feed link, 0 = hide, 1 = show (Default:1) * @param binary $end_time include end time in event lists, 0 = hide, 1 = show (Default:1) * @param string $menu_format menu format string, accepts any supported strftime() format parameters (Default:%a %m/%d) * @return void */ function ou_event_carousel($submit = 1, $ical = 1, $rss = 1, $end_time = 1, $menu_format = '%a %m/%d') { global $hc_cfg, $hc_lang_core; include HCLANG . '/public/integration.php'; echo "SYSDATE: " . SYSDATE . "\n"; if (file_exists(HCPATH . '/cache/int14_' . SYSDATE . '.php')) { if (count(glob(HCPATH . '/cache/int14_*.php')) > 0) { foreach (glob(HCPATH . '/cache/int14_*.php') as $file) { unlink($file); } } ob_start(); $fp = fopen(HCPATH . '/cache/int14_' . SYSDATE . '.php', 'w'); fwrite($fp, "<?php\n//\tHelios Dashboard Integration Events Cache - Delete this file when upgrading.\n"); //link, category, title, start date, end date, start time, end time, location, description //array("05/15/2015 - 05/15/2015","1","test event") $result = doQuery("SELECT PkID, Title, Description, StartDate, EndDate, StartTime, EndTime, TBD, LocID, LocationName FROM " . HC_TblPrefix . "events\nWHERE IsActive = 1 AND IsApproved = 1 AND StartDate Between '" . SYSDATE . "' AND ADDDATE('" . SYSDATE . "', INTERVAL 14 DAY)\nORDER BY StartDate, TBD, StartTime, Title, LocationName"); if (hasRows($result)) { $cur_day = -1; $cur_date = ''; fwrite($fp, "\$hc_next14 = array(\n"); while ($row = mysql_fetch_row($result)) { print_r($row); $ouTitle = $row[1]; $ouDesc = $row[2]; $ouLoc = $row[7]; //echo "\nouLoc: " . $ouLoc; if ($cur_date = $row[3]) { ++$cur_day; $cur_date = $row[3]; if ($cur_day > 0) { fwrite($fp, "\t),\n"); } fwrite($fp, $cur_day . " => array(\n"); } if ($row[6] == 0) { $time = $row[4] != '' ? stampToDate($row[4], $hc_cfg[24]) : ''; $time .= $row[5] != '' && $end_time == 1 ? ' - ' . stampToDate($row[5], $hc_cfg[24]) : ''; } else { $time = $row[6] == 1 ? $hc_lang_int['AllDay'] : $hc_lang_int['TimeTBA']; } fwrite($fp, "\t" . $row[0] . " => array(\"" . $time . "\",\"" . stampToDate($row[3], $hc_cfg[15]) . "\",\"" . str_replace("\"", "'", cOut($row[1])) . "\"),\n"); } fwrite($fp, "\t),"); } fwrite($fp, "\n)\n?>"); fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } include HCPATH . '/cache/int14_' . SYSDATE . '.php'; }
function startNewSession() { global $hc_cfg; $aUser = isset($_SESSION['AdminPkID']) ? cIn($_SESSION['AdminPkID']) : 0; $resultAS = doQuery("SELECT Access FROM " . HC_TblPrefix . "admin WHERE PkID = '" . $aUser . "'"); $knownSession = hasRows($resultAS) ? mysql_result($resultAS, 0, 0) : NULL; if ($knownSession != md5(session_id())) { killAdminSession(); } else { $_SESSION['hc_SessionReset'] = date("U") + mt_rand(60, 900); } $old_session = session_id(); session_regenerate_id(); $new_session = session_id(); session_write_close(); session_id($new_session); session_name($hc_cfg[200]); session_start(); $_SESSION['hc_whoami'] = md5($_SERVER['REMOTE_ADDR'] . session_id()); if (isset($_COOKIE[$old_session])) { setcookie($old_session, '', time() - 86400, '/'); } doQuery("UPDATE " . HC_TblPrefix . "admin SET Access = '" . cIn(md5(session_id())) . "' WHERE PkID = '" . $aUser . "'"); }
go_home(); } if (!isset($_GET['dID'])) { $tID = isset($_POST['tID']) && is_numeric($_POST['tID']) ? cIn(strip_tags($_POST['tID'])) : ''; $name = isset($_POST['name']) ? cIn($_POST['name']) : ''; $content = isset($_POST['ex_data']) ? cIn($_POST['ex_data']) : ''; $header = isset($_POST['ex_header']) ? cIn($_POST['ex_header']) : ''; $footer = isset($_POST['ex_footer']) ? cIn($_POST['ex_footer']) : ''; $ext = isset($_POST['ext']) ? cIn($_POST['ext']) : ''; $typeID = isset($_POST['typeID']) ? cIn($_POST['typeID']) : ''; $groupBy = isset($_POST['group']) ? cIn($_POST['group']) : ''; $sortBy = isset($_POST['sort']) ? cIn($_POST['sort']) : ''; $dateFormat = isset($_POST['dateFormat']) ? cIn($_POST['dateFormat']) : ''; $cleanup = isset($_POST['cleanup']) ? cIn($_POST['cleanup']) : ''; $result = doQuery("SELECT * FROM " . HC_TblPrefix . "templates WHERE PkID = '" . $tID . "' AND IsActive = 1"); if (hasRows($result)) { $msgID = 1; doQuery("UPDATE " . HC_TblPrefix . "templates\r\n\t\t\t\t\t\tSET Name = '" . $name . "',\r\n\t\t\t\t\t\t\tContent = '" . $content . "',\r\n\t\t\t\t\t\t\tHeader = '" . $header . "',\r\n\t\t\t\t\t\t\tFooter = '" . $footer . "',\r\n\t\t\t\t\t\t\tExtension = '" . $ext . "',\r\n\t\t\t\t\t\t\tTypeID = '" . $typeID . "',\r\n\t\t\t\t\t\t\tGroupBy = '" . $groupBy . "',\r\n\t\t\t\t\t\t\tSortBy = '" . $sortBy . "',\r\n\t\t\t\t\t\t\tCleanUp = '" . $cleanup . "',\r\n\t\t\t\t\t\t\tDateFormat = '" . $dateFormat . "'\r\n\t\t\t\t\t\tWHERE PkID = '" . $tID . "'"); } else { $msgID = 2; doQuery("INSERT INTO " . HC_TblPrefix . "templates(Name, Content, Header, Footer, Extension, TypeID, GroupBy, SortBy, DateFormat, CleanUp, IsActive)\r\n\t\t\t\t\tVALUES(\t'" . $name . "','" . $content . "','" . $header . "','" . $footer . "','" . $ext . "',\r\n\t\t\t\t\t\t\t'" . $typeID . "','" . $groupBy . "','" . $sortBy . "','" . $dateFormat . "','" . $cleanup . "',1)"); $result = doQuery("SELECT LAST_INSERT_ID() FROM " . HC_TblPrefix . "locations"); $lID = hasRows($result) ? mysql_result($result, 0, 0) : 0; } } else { $msgID = 3; $dID = isset($_GET['dID']) && is_numeric($_GET['dID']) ? cIn(strip_tags($_GET['dID'])) : 0; doQuery("UPDATE " . HC_TblPrefix . "templates SET IsActive = 0 WHERE PkID = '" . $dID . "'"); doQuery("UPDATE " . HC_TblPrefix . "events SET LocationName = 'Unknown', LocID = 0 WHERE LocID = '" . $dID . "'"); } header('Location: ' . AdminRoot . '/index.php?com=exporttmplts&msg=' . $msgID);
/** * Output weekly dashboard to a page outside of Helios Calendar. * @since 2.0.1 * @version 2.0.1 * @param binary $submit include submit event link, 0 = hide , 1 = show (Default:1) * @param binary $ical include iCalendar subscription link, 0 = hide, 1 = show (Default:1) * @param binary $rss include All Events rss feed link, 0 = hide, 1 = show (Default:1) * @param binary $end_time include end time in event lists, 0 = hide, 1 = show (Default:1) * @param string $menu_format menu format string, accepts any supported strftime() format parameters (Default:%a %m/%d) * @return void */ function int_week_dashboard($submit = 1, $ical = 1, $rss = 1, $end_time = 1, $menu_format = '%a %m/%d') { global $hc_cfg, $hc_lang_core; include HCLANG . '/public/integration.php'; if (!file_exists(HCPATH . '/cache/int7_' . SYSDATE . '.php')) { if (count(glob(HCPATH . '/cache/int7_*.php')) > 0) { foreach (glob(HCPATH . '/cache/int7_*.php') as $file) { unlink($file); } } ob_start(); $fp = fopen(HCPATH . '/cache/int7_' . SYSDATE . '.php', 'w'); fwrite($fp, "<?php\n//\tHelios Dashboard Integration Events Cache - Delete this file when upgrading.\n"); $result = doQuery("SELECT PkID, Title, StartDate, StartTime, EndTime, TBD FROM " . HC_TblPrefix . "events \r\n\t\t\t\t\t\t\tWHERE IsActive = 1 AND IsApproved = 1 AND StartDate Between '" . SYSDATE . "' AND ADDDATE('" . SYSDATE . "', INTERVAL 6 DAY)\r\n\t\t\t\t\t\t\tORDER BY StartDate, TBD, StartTime, Title"); if (hasRows($result)) { $cur_day = -1; $cur_date = ''; fwrite($fp, "\$hc_next7 = array(\n"); while ($row = mysql_fetch_row($result)) { if ($cur_date != $row[2]) { ++$cur_day; $cur_date = $row[2]; if ($cur_day > 0) { fwrite($fp, "\t),\n"); } fwrite($fp, $cur_day . " => array(\n"); } if ($row[5] == 0) { $time = $row[3] != '' ? stampToDate($row[3], $hc_cfg[23]) : ''; $time .= $row[4] != '' && $end_time == 1 ? ' - ' . stampToDate($row[4], $hc_cfg[23]) : ''; } else { $time = $row[5] == 1 ? $hc_lang_int['AllDay'] : $hc_lang_int['TimeTBA']; } fwrite($fp, "\t" . $row[0] . " => array(\"" . $time . "\",\"" . stampToDate($row[2], $hc_cfg[14]) . "\",\"" . str_replace("\"", "'", cOut($row[1])) . "\"),\n"); } fwrite($fp, "\t),"); } fwrite($fp, "\n)\n?>"); fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } include HCPATH . '/cache/int7_' . SYSDATE . '.php'; echo ' <script> //<!-- function hc_tog_dash(show){var i = 0;while(i <= 6){document.getElementById("hc_dashboard_day"+i).style.display = (i == show) ? "block" : "none";i++;}} //--> </script> <div id="hc_dashboard"> <ul id="menu"> <li><a href="javascript:;" onclick="hc_tog_dash(0);return false;">' . strftime($menu_format, strtotime(SYSDATE) + 86400 * 0) . '</a></li> <li><a href="javascript:;" onclick="hc_tog_dash(1);return false;">' . strftime($menu_format, strtotime(SYSDATE) + 86400 * 1) . '</a></li> <li><a href="javascript:;" onclick="hc_tog_dash(2);return false;">' . strftime($menu_format, strtotime(SYSDATE) + 86400 * 2) . '</a></li> <li><a href="javascript:;" onclick="hc_tog_dash(3);return false;">' . strftime($menu_format, strtotime(SYSDATE) + 86400 * 3) . '</a></li> <li><a href="javascript:;" onclick="hc_tog_dash(4);return false;">' . strftime($menu_format, strtotime(SYSDATE) + 86400 * 4) . '</a></li> <li><a href="javascript:;" onclick="hc_tog_dash(5);return false;">' . strftime($menu_format, strtotime(SYSDATE) + 86400 * 5) . '</a></li> <li><a href="javascript:;" onclick="hc_tog_dash(6);return false;">' . strftime($menu_format, strtotime(SYSDATE) + 86400 * 6) . '</a></li> ' . ($rss == 1 && $hc_cfg[106] == 1 ? '<li class="icon"><a href="' . CalRoot . '/rss/" title="' . $hc_lang_int['TitleRSS'] . '" rel="nofollow" target="_blank"><img src="' . CalRoot . '/img/feed.png" width="16" height="16" alt="" /></a></li>' : '') . ' ' . ($ical == 1 && $hc_cfg[108] == 1 ? '<li class="icon"><a href="webcal://' . substr(CalRoot, 7) . '/link/ical.php" title="' . $hc_lang_int['TitleiCal'] . '" rel="nofollow"><img src="' . CalRoot . '/img/icons/ical.png" width="16" height="16" alt="" /></a></li>' : '') . ' </ul>'; $date = ''; foreach ($hc_next7 as $day => $arr) { foreach ($arr as $id => $value) { if ($date != $value[1]) { $date = $value[1]; echo ' <div id="hc_dashboard_day' . $day . '" class="hc_dashboard_day"' . ($day > 0 ? ' style="display:none;"' : '') . '> <ul> <li>' . $value[1] . '</li>'; } echo ' <li><div class="time">' . $value[0] . '</div><a href="' . CalRoot . '/index.php?eID=' . $id . '" rel="nofollow">' . cOut($value[2]) . '</a></li>'; } echo $date != '' ? ' </ul> </div>' : ''; } echo $date == '' ? $hc_lang_int['NoEvent'] : ''; echo ' <a href="' . CalRoot . '/" rel="nofollow">' . $hc_lang_int['Browse'] . '</a> ' . ($submit == 1 ? '| <a href="' . CalRoot . '/index.php?com=submit" rel="nofollow">' . $hc_lang_int['Submit'] . '</a>' : '') . ' </div>'; }
if (!defined('hcAdmin')) { header("HTTP/1.1 403 No Direct Access"); exit; } include HCLANG . '/admin/reports.php'; $eID = isset($_POST['eventID']) ? implode(',', array_filter($_POST['eventID'], 'is_numeric')) : array(); $hc_Side[] = array('javascript:doDownload();', 'download_csv.png', $hc_lang_reports['DownloadRep'], 0); appInstructions(0, "Reports", $hc_lang_reports['TitleAct'], $hc_lang_reports['InstructAct']); echo ' <p><a href="' . AdminRoot . '/index.php?com=eventsearch" class="add"><img src="' . AdminRoot . '/img/icons/report.png" width="16" height="16" alt="" />' . $hc_lang_reports['NewReport'] . '</a></p>'; if (count($eID) > 0) { $result = doQuery("SELECT e.PkID, e.Title, e.StartDate, e.Views, e.Directions, e.Downloads, e.EmailToFriend, e.URLClicks\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "events e\r\n\t\t\t\t\t\tWHERE e.PkID IN(" . cIn($eID) . ") ORDER BY e.PkID"); if (hasRows($result)) { $mViews = $mDir = $mDwnl = $mEmail = $mURL = $aViews = $aDir = $aDwnl = $aEmail = $aURL = $cnt = 0; $resultX = doQuery("SELECT MAX(Views), MAX(Directions), MAX(Downloads), MAX(EmailToFriend), MAX(URLClicks),\r\n\t\t\t\t\t\t\t\t\tAVG(Views), AVG(Directions), AVG(Downloads), AVG(EmailToFriend), AVG(URLClicks)\r\n\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "events\r\n\t\t\t\t\t\t\tWHERE IsActive = 1 AND IsApproved = 1"); if (hasRows($resultX)) { $mViews = cOut(mysql_result($resultX, 0, 0)); $mDir = cOut(mysql_result($resultX, 0, 1)); $mDwnl = cOut(mysql_result($resultX, 0, 2)); $mEmail = cOut(mysql_result($resultX, 0, 3)); $mURL = cOut(mysql_result($resultX, 0, 4)); $aViews = cOut(round(mysql_result($resultX, 0, 5), 0)); $aDir = cOut(round(mysql_result($resultX, 0, 6), 0)); $aDwnl = cOut(round(mysql_result($resultX, 0, 7), 0)); $aEmail = cOut(round(mysql_result($resultX, 0, 8), 0)); $aURL = cOut(round(mysql_result($resultX, 0, 9), 0)); } echo ' <ul class="data"> <li class="row header"> <div style="width:31%;"> </div>
*/ if (!defined('hcAdmin')) { header("HTTP/1.1 403 No Direct Access"); exit; } $errorMsg = $bitURL = ''; if (isset($eID) && is_numeric($eID)) { $resultB = doQuery("SELECT ShortURL FROM " . HC_TblPrefix . "events WHERE PkID = '" . cIn($eID) . "'"); } elseif (isset($lID) && is_numeric($lID)) { $resultB = doQuery("SELECT ShortURL FROM " . HC_TblPrefix . "locations WHERE PkID = '" . cIn($lID) . "'"); } if (hasRows($resultB) && mysql_result($resultB, 0, 0) != '') { $shortLink = strpos(mysql_result($resultB, 0, 0), "http://") !== false ? mysql_result($resultB, 0, 0) : $shortLink; } else { $resultB = doQuery("SELECT SettingValue FROM " . HC_TblPrefix . "settings WHERE PkID IN(57,58)"); if (!hasRows($resultB)) { $errorMsg = 'bitly API Settings Unavailable.'; } else { if (mysql_result($resultB, 0, 0) == '' && mysql_result($resultB, 1, 0) == '') { $errorMsg = 'bitly API Settings Missing.'; } else { $bitlyUser = mysql_result($resultB, 0, 0); $bitlyAPI = mysql_result($resultB, 1, 0); $bSend = "/v3/shorten?format=xml&login="******"&apiKey=" . $bitlyAPI . "&longUrl=" . urlencode($shortLink); $host = 'api-ssl.bitly.com'; if (!($fp = fsockopen("ssl://api-ssl.bitly.com", 443, $errno, $errstr, 20))) { $host = 'api.bitly.com'; $fp = fsockopen("api.bitly.com", 80, $errno, $errstr, 20); } if (!$fp) { $apiFail = true;
$resLimit = 10; $locName = isset($_GET['q']) && $_GET['q'] != '' ? cIn(strip_tags($_GET['q'])) : ''; $resOffset = isset($_GET['o']) && is_numeric($_GET['o']) ? cIn(strip_tags($_GET['o'])) : 0; $po = isset($_GET['po']) && is_numeric($_GET['po']) ? cIn(strip_tags($_GET['po'])) : 1; $eo = isset($_GET['eo']) && is_numeric($_GET['eo']) ? cIn(strip_tags($_GET['eo'])) : 0; if ($locName != '') { if ($eo == 0) { $pQuery = $po == 0 ? '' : ' AND IsPublic = 1'; $result = doQuery("SELECT PkID, Name, Address, Address2, City, State, Zip, Country, Lat, Lon\r\n\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "locations\r\n\t\t\t\t\t\t\tWHERE NAME LIKE('%" . $locName . "%')" . $pQuery . " AND IsActive = 1\r\n\t\t\t\t\t\t\tORDER BY Name LIMIT " . $resLimit . " OFFSET " . $resOffset * $resLimit); $resultP = doQuery("SELECT COUNT(PkID) FROM " . HC_TblPrefix . "locations WHERE NAME LIKE('%" . cIn($locName) . "%')" . $pQuery . " AND IsActive = 1"); } else { $result = doQuery("SELECT DISTINCT(l.PkID), l.Name, l.Address, l.Address2, l.City, l.State, l.Zip, l.Country, l.Lat, l.Lon\r\n\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "locations l\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "events e ON (e.LocID = l.PkID)\r\n\t\t\t\t\t\t\tWHERE l.NAME LIKE('%" . $locName . "%') AND l.IsActive = 1\r\n\t\t\t\t\t\t\t\tAND e.IsActive = 1 AND e.IsApproved = 1 AND e.StartDate >= '" . date("Y-m-d") . "'\r\n\t\t\t\t\t\t\tORDER BY Name LIMIT " . $resLimit . " OFFSET " . $resOffset * $resLimit); $resultP = doQuery("SELECT COUNT(DISTINCT(l.PkID)) FROM " . HC_TblPrefix . "locations l LEFT JOIN " . HC_TblPrefix . "events e ON (e.LocID = l.PkID) WHERE NAME LIKE('%" . $locName . "%') AND l.IsPublic = 1 AND l.IsActive = 1 AND e.IsActive = 1 AND e.IsApproved = 1 AND e.StartDate >= '" . date("Y-m-d") . "'"); } } if (isset($result) && hasRows($result)) { $x = 0; while ($row = mysql_fetch_row($result)) { $locAddress = buildAddress(htmlentities($row[3], ENT_QUOTES), htmlentities($row[2], ENT_QUOTES), htmlentities($row[4], ENT_QUOTES), htmlentities($row[5], ENT_QUOTES), htmlentities($row[6], ENT_QUOTES), htmlentities($row[7], ENT_QUOTES), $hc_lang_config['AddressType']); $locAddress = str_replace('<br />', ', ', $locAddress); $hl = $x % 2 == 0 ? ' class="hl_frm"' : ''; echo ' <label' . $hl . ' for="locValue_' . $row[0] . '"><input name="locValue" id="locValue_' . $row[0] . '" type="radio" onclick="setLocation(' . $row[0] . ',\'' . htmlentities(str_replace('\'', '\\\'', $row[1]), ENT_QUOTES) . '\', 1);" />'; echo $hc_cfg[52] != '' && ($row[8] != '' && $row[9] != '') ? '<a href="' . $hc_cfg[52] . 'maps?q=' . $row[8] . ',' . $row[9] . '" target="_blank"><img src="' . CalRoot . '/img/icons/map.png" width="16" height="16" class="pull-left" alt="' . $hc_lang_search['Map'] . '" /></a>' : ''; echo $po == 0 && isset($_SESSION['AdminLoggedIn']) ? '<a href="' . AdminRoot . '/index.php?com=addlocation&lID=' . $row[0] . '" target="_blank"><img src="' . AdminRoot . '/img/icons/edit.png" width="16" height="16" alt="" /></a>' : ''; echo ' <span class="loc_name">' . htmlentities($row[1], ENT_QUOTES) . '</span> <span class="loc_add">' . $locAddress . '</span></label>'; ++$x; } $pages = ceil(mysql_result($resultP, 0, 0) / $resLimit);
/** * @package Helios Calendar * @license GNU General Public License version 2 or later; see LICENSE */ define('hcAdmin', true); include '../loader.php'; admin_logged_in(); action_headers(); post_only(); $token = isset($_POST['token']) ? cIn(strip_tags($_POST['token'])) : ''; if (!check_form_token($token)) { go_home(); } $result = doQuery("SELECT GROUP_CONCAT(PkID) FROM " . HC_TblPrefix . "events WHERE IsActive = 0 OR IsApproved = 0 OR StartDate = '0000-00-00'"); if (hasRows($result) & mysql_result($result, 0, 0) != '') { doQuery("DELETE FROM " . HC_TblPrefix . "eventnetwork WHERE EventID IN (" . mysql_result($result, 0, 0) . ")"); } doQuery("DELETE FROM " . HC_TblPrefix . "events WHERE IsActive = 0 OR IsApproved = 0 OR StartDate = '0000-00-00'"); doQuery("DELETE en FROM " . HC_TblPrefix . "eventnetwork en LEFT JOIN " . HC_TblPrefix . "events e ON (e.PkID = en.EventID) WHERE e.PkID IS NULL OR e.IsActive = 0 OR e.IsApproved = 0"); doQuery("DELETE FROM " . HC_TblPrefix . "locations WHERE IsActive = 0"); doQuery("DELETE ln FROM " . HC_TblPrefix . "locationnetwork ln LEFT JOIN " . HC_TblPrefix . "locations l ON (l.PkID = ln.LocationID) WHERE l.PkID IS NULL OR l.IsActive = 0"); doQuery("DELETE ec FROM " . HC_TblPrefix . "eventcategories ec LEFT JOIN " . HC_TblPrefix . "events e ON (ec.EventID = e.PkID) WHERE e.PkID is NULL OR e.IsActive = 0 OR e.IsApproved = 0"); doQuery("DELETE er FROM " . HC_TblPrefix . "eventrsvps er LEFT JOIN " . HC_TblPrefix . "events e ON (er.EventID = e.PkID) WHERE e.PkID is NULL OR e.IsActive = 0 OR e.IsApproved = 0"); doQuery("DELETE FROM " . HC_TblPrefix . "categories WHERE IsActive = 0"); doQuery("DELETE FROM " . HC_TblPrefix . "templates WHERE IsActive = 0"); doQuery("DELETE FROM " . HC_TblPrefix . "templatesnews WHERE IsActive = 0"); doQuery("DELETE FROM " . HC_TblPrefix . "mailers WHERE IsActive = 0"); doQuery("DELETE mg FROM " . HC_TblPrefix . "mailersgroups mg LEFT JOIN " . HC_TblPrefix . "mailers m ON (m.PkID = mg.MailerID) WHERE m.PkID IS NULL OR m.IsActive = 0"); doQuery("DELETE FROM " . HC_TblPrefix . "mailgroups WHERE IsActive = 0"); doQuery("DELETE FROM " . HC_TblPrefix . "newsletters WHERE IsActive = 0");
$ebAPI = cOut(mysql_result($result, 0, 0)); $ebUser = cOut(mysql_result($result, 1, 0)); if ($ebAPI == '' || $ebUser == '') { $apiFail = true; $errorMsg = 'Eventbrite API Settings Missing.'; } else { $ebID = !isset($ebID) ? 0 : $ebID; $ebSend = $ebID == 0 ? "/xml/event_new?app_key=" . $ebAPI . "&user_key=" . $ebUser : "******" . $ebAPI . "&user_key=" . $ebUser; $endTime = isset($_POST['ignoreendtime']) ? $startTime : $endTime; $endDate = $eventDate; if ($startTime > $endTime) { $dateParts = explode("-", $eventDate); $endDate = date("Y-m-d", mktime(0, 0, 0, $dateParts[1], $dateParts[2] + 1, $dateParts[0])); } $resultLoc = doQuery("SELECT NetworkID FROM " . HC_TblPrefix . "locationnetwork WHERE NetworkType = 2 AND LocationID = '" . $locID . "'"); $venueID = hasRows($resultLoc) ? mysql_result($resultLoc, 0, 0) : ''; $ebStatus = isset($_POST['ebStatus']) ? cIn($_POST['ebStatus']) : 'draft'; $ebPrivacy = isset($_POST['ebPrivacy']) ? cIn($_POST['ebPrivacy']) : '0'; $ebTimezone = isset($_POST['ebTimezone']) ? cIn($_POST['ebTimezone']) : substr(HCTZ, 0, 3); $ebCurrency = isset($_POST['ebCurrency']) ? cIn($_POST['ebCurrency']) : 'USD'; $ebOrganizer = isset($_POST['ebOrgID']) ? cIn($_POST['ebOrgID']) : $hc_cfg[62]; $eventD = utf8_encode(htmlentities(strip_tags($eventDesc))); if (strlen($eventD) > 400) { $eventD = clean_truncate($eventDesc, 400) . '<br /><br /><a href="' . CalRoot . '/index.php?eID=' . $eID . '">' . utf8_encode(htmlentities($hc_lang_event['EventbriteFull'])) . '</a>'; } $ebSend .= "&title=" . urlencode(utf8_encode(htmlentities($eventTitle))); $ebSend .= "&description=" . urlencode(utf8_encode(nl2br($eventD))); $ebSend .= "&start_date=" . $eventDate . "+" . str_replace("'", "", $startTime); $ebSend .= "&end_date=" . $endDate . "+" . str_replace("'", "", $endTime); $ebSend .= "&timezone=" . $ebTimezone; $ebSend .= "&privacy=" . $ebPrivacy;
/** * Update status, and variables, for user's current session. Called at regular intervals to rebuild the session id (user_new_session()) & update the user's status (incase of deletion or banning by admin). * @since 2.1.0 * @version 2.1.0 * @param int $network Network ID (internal) 1 = Twitter, 2 = Facebook, 3 = Google * @param string $net_name User's name provided by the network API. * @param string $net_id Users's id # provided by the network API. * @param integer $signed_in User's current signed in status. * @return void */ function user_update_status($network, $net_name, $net_id, $signed_in) { $result = doQuery("SELECT PkID, Level, IsBanned FROM " . HC_TblPrefix . "users WHERE NetworkType = '" . cIn($network) . "' AND NetworkID = '" . cIn($net_id) . "'"); if ($signed_in == 1 && hasRows($result) && mysql_result($result, 0, 2) == 0) { user_new_session(); $_SESSION['UserLoggedIn'] = 1; $_SESSION['UserNetType'] = cIn($network); $_SESSION['UserNetName'] = cIn($net_name); $_SESSION['UserNetID'] = cIn($net_id); $_SESSION['UserPkID'] = mysql_result($result, 0, 0); $_SESSION['UserLevel'] = mysql_result($result, 0, 1); } else { session_destroy(); } }
function sr_news_link_archive() { global $hc_lang_news; $result = doQuery("SELECT PkID, Subject, SentDate FROM " . HC_TblPrefix . "newsletters"); if (hasRows($result)) { echo '<div class="newsTools"> <a href="' . CalRoot . '/index.php?com=archive" class="icon news_a">' . $hc_lang_news['NewsOpt0'] . '</a></div>'; } }
} //--> </script>'; } else { echo '<p>' . $hc_lang_news['NoDraft'] . '</p>'; } } else { $result = doQuery("SELECT m.PkID, m.Title, m.Subject, m.StartDate, m.EndDate, m.IsArchive, m.Message, tn.TemplateName, tn.TemplateSource\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "mailers m\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "templatesnews tn ON (m.TemplateID = tn.PkID AND tn.IsActive = 1)\r\n\t\t\t\t\t\tWHERE m.PkID = '" . $mID . "' AND m.IsActive = 1"); if (hasRows($result)) { $now = date("Y-m-d"); $mStart = $now > mysql_result($result, 0, 3) ? $now : mysql_result($result, 0, 3); $mEnd = mysql_result($result, 0, 4); $groups = ''; $cnt = $allSub = $subCnt = 0; $resultG = doQuery("SELECT mg.PkID, mg.Name, m.PkID as Selected\r\n\t\t\t\t\t\t\t FROM " . HC_TblPrefix . "mailgroups mg\r\n\t\t\t\t\t\t\t\t LEFT JOIN " . HC_TblPrefix . "mailersgroups mgs ON (mgs.GroupID = mg.PkID AND mgs.MailerID = '" . $mID . "')\r\n\t\t\t\t\t\t\t\t LEFT JOIN " . HC_TblPrefix . "mailers m ON (mgs.MailerID = m.PkID and m.IsActive = 1)\r\n\t\t\t\t\t\t\t WHERE mg.IsActive = 1\r\n\t\t\t\t\t\t\t Group By mg.PkID, mg.Name, m.PkID\r\n\t\t\t\t\t\t\t ORDER BY mg.Name"); if (hasRows($resultG)) { while ($row = mysql_fetch_row($resultG)) { if ($row[2] != '') { $allSub += $row[0] == 1 ? 1 : 0; $groups .= $cnt > 0 ? ', ' : ''; $groups .= cOut($row[1]); ++$cnt; } } } if ($allSub > 0) { $resultS = doQuery("SELECT COUNT(PkID) FROM " . HC_TblPrefix . "subscribers WHERE IsConfirm = 1"); } else { $resultS = doQuery("SELECT COUNT(DISTINCT sgs.UserID)\r\n\t\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "subscribersgroups sgs\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "mailgroups mg ON (sgs.GroupID = mg.PkID AND mg.IsActive = 1)\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "mailersgroups mgs ON (mgs.GroupID = sgs.GroupID)\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "mailers m ON (mgs.MailerID = m.PkID AND m.IsActive = 1)\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "subscribers s ON (s.PkID = sgs.UserID)\r\n\t\t\t\t\t\t\t\tWHERE m.PkID = '" . $mID . "' AND s.IsConfirm = 1"); } $subCnt = mysql_result($resultS, 0, 0);
/** * Create JavaScript array() variable named "locations" with location entries for use with location Google map. Saves array to cache if cache not present. * @since 2.0.0 * @version 2.1.0 * @return void */ function map_locations() { global $hc_cfg; if (!file_exists(HCPATH . '/cache/lmap' . SYSDATE)) { purge_cache_map(); $cnt = 0; ob_start(); $fp = fopen(HCPATH . '/cache/lmap' . SYSDATE, 'w'); $result = doQuery("SELECT l.PkID, l.Name, l.Address, l.Address2, l.City, l.State, l.Country, l.Zip, l.Lat, l.Lon, COUNT(e.LocID), MIN(e.StartDate), l.URL, l.Phone\r\n\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "locations l\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "events e ON (e.LocID = l.PkID)\r\n\t\t\t\t\t\t\tWHERE l.Lat IS NOT NULL AND l.Lon IS NOT NULL AND l.Lat != '' AND l.Lon != '' AND l.IsActive = 1 AND\r\n\t\t\t\t\t\t\t\te.LocID > 0 AND e.IsActive = 1 AND e.IsApproved = 1 AND e.PkID IS NOT NULL AND e.StartDate >= '" . cIn(SYSDATE) . "'\r\n\t\t\t\t\t\t\tGROUP BY l.PkID, l.Name, l.Address, l.Address2, l.City, l.State, l.Country, l.Zip, l.Lat, l.Lon, l.URL, l.Phone\r\n\t\t\t\t\t\t\tHAVING COUNT(e.LocID) > 0\r\n\t\t\t\t\t\t\tORDER BY l.Name"); if (hasRows($result)) { echo ' var locations = ['; while ($row = mysql_fetch_row($result)) { echo ' ["' . $row[0] . '","' . cOut($row[1]) . '","' . $row[8] . '","' . $row[9] . '","' . cOut($row[1]) . '","' . cOut($row[2]) . '","' . cOut($row[3]) . '","' . cOut($row[4]) . '","' . cOut($row[5]) . '","' . cOut($row[6]) . '","' . cOut($row[7]) . '","' . $row[10] . '","' . stampToDate($row[11], $hc_cfg[14]) . '","' . ($row[12] != '' && $row[12] != 'http://' ? '1' : '0') . '","' . cOut($row[13]) . '"],'; ++$cnt; } echo ' ];'; } fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } include HCPATH . '/cache/lmap' . SYSDATE; }
/** * Create CSV of RSVPs for a given event. * @since 2.2.0 * @version 2.2.0 * @param integer $event_id ID # of the event to retrieve RSVPs for. * @return string RSVP data in CSV format. */ function fetch_event_rsvp($event_id = 0, $header) { if (!is_numeric($event_id) || $event_id <= 0) { return NULL; } $result = doQuery("SELECT r.Name, r.Email, r.Phone, r.Address, r.Address2, r.City, r.State, r.Zip, r.RegisteredAt, r.GroupID\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "registrants r\r\n\t\t\t\t\t\tWHERE EventID = '" . cIn($event_id) . "'\r\n\t\t\t\t\t\tGROUP BY r.PkID, r.Name, r.Email, r.Phone, r.Address, r.Address2, r.City, r.State, r.Zip, r.RegisteredAt, r.GroupID\r\n\t\t\t\t\t\tORDER BY RegisteredAt, GroupID"); $rsvps = ""; if (hasRows($result)) { $rsvps = $header; while ($row = mysql_fetch_row($result)) { $rsvps .= "\n" . '"' . clean_csv($row[0]) . '","' . clean_csv($row[1]) . '","' . clean_csv($row[2]) . '","' . clean_csv($row[3]) . '","' . clean_csv($row[4]) . '","' . clean_csv($row[5]) . '","' . clean_csv($row[6]) . '","' . clean_csv($row[7]) . '","' . clean_csv($row[8]) . '","' . clean_csv($row[9]) . '"'; } } return $rsvps; }
/** * Output digest newsletters list. Newsletters listed in decending order by sent date. * @since 2.1.0 * @version 2.1.0 * @param integer $size max number of newsletters to include in the list (list may be smaller depending on settings/available newsletters). * @return void */ function digest_newsletter_list($size, $dateFormat = '') { global $hc_cfg, $hc_lang_pages; if (!file_exists(HCPATH . '/cache/digest_' . SYSDATE . '_n')) { ob_start(); $fp = fopen(HCPATH . '/cache/digest_' . SYSDATE . '_n', 'w'); $result = doQuery("SELECT PkID, Subject, SentDate FROM " . HC_TblPrefix . "newsletters WHERE Status > 0 AND IsArchive = 1 AND IsActive = 1 AND ArchiveContents != '' ORDER BY SentDate DESC LIMIT " . $size); if (!hasRows($result)) { echo ' <ul class="newsletters"><li>' . $hc_lang_pages['NoNewsletters'] . '</li></ul>'; return 0; } $cnt = 1; $dateFormat = $dateFormat == '' ? $hc_cfg[24] : $dateFormat; echo ' <ul class="newsletters">'; while ($row = mysql_fetch_row($result)) { $hl = $cnt % 2 == 0 ? ' class="hl"' : ''; echo '<li' . $hl . '><time datetime="' . stampToDate($row[2], '%Y-%m-%d') . '">' . stampToDate($row[2], $dateFormat) . '</time><a href="' . CalRoot . '/newsletter/index.php?n=' . md5($row[0]) . '" target="_blank">' . cOut($row[1]) . '</a></li>'; ++$cnt; } echo ' </ul>'; fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } include HCPATH . '/cache/digest_' . SYSDATE . '_n'; }
<?php /** * @package Helios Calendar * @license GNU General Public License version 2 or later; see LICENSE */ define('hcAdmin', true); include '../loader.php'; admin_logged_in(); action_headers(); $pID = isset($_GET['pID']) && is_numeric($_GET['pID']) ? cIn(strip_tags($_GET['pID'])) : 0; $result = doQuery("SELECT TemplateSource FROM " . HC_TblPrefix . "templatesnews WHERE PkID = '" . $pID . "'"); echo hasRows($result) ? cOut(mysql_result($result, 0, 0)) : $hc_lang_news['InvalidTemplate'];
$challenge = isset($_POST["recaptcha_challenge_field"]) ? $_POST["recaptcha_challenge_field"] : NULL; } spamIt($proof, $challenge, 2); $myName = cIn(strip_tags(cleanBreaks($_POST['hc_fx1']))); $myEmail = cIn(strip_tags(cleanBreaks($_POST['hc_fx2']))); $friendName = cIn(strip_tags(cleanBreaks($_POST['hc_fx3']))); $friendEmail = cIn(strip_tags(cleanBreaks($_POST['hc_fx4']))); $sendMsg = cleanBreaks(nl2br(strip_tags($_POST['hc_fx5']))); $eID = isset($_POST['eID']) && is_numeric($_POST['eID']) ? cIn(strip_tags($_POST['eID'])) : 0; $tID = isset($_POST['tID']) && is_numeric($_POST['tID']) ? cIn(strip_tags($_POST['tID'])) : 0; if ($tID == 0) { $result = doQuery("SELECT Title, StartDate, StartTime, TBD FROM " . HC_TblPrefix . "events WHERE PkID = '" . $eID . "'"); } else { $result = doQuery("SELECT Name, Address, Address2, City, State, Zip, Country FROM " . HC_TblPrefix . "locations WHERE PkID = '" . $eID . "'"); } if (hasRows($result) && $myName != '' && $myEmail != '' && $friendName != '' && $friendEmail != '') { $message = '<p>' . cOut($sendMsg) . '</p>'; $message .= '<p><b>' . mysql_result($result, 0, 0) . '</b><br />'; if ($tID == 0) { $where = '/index.php?com=send&eID='; $subject = CalName . " " . $hc_lang_sendtofriend['SubjectE'] . " " . $myName; $message .= stampToDate(mysql_result($result, 0, 1), $hc_cfg[14]) . ' - '; if (mysql_result($result, 0, 3) == 0) { $message .= stampToDate("1980-01-01 " . mysql_result($result, 0, 2), $hc_cfg[23]); } elseif (mysql_result($result, 0, 3) == 1) { $message .= $hc_lang_sendtofriend['AllDay']; } elseif (mysql_result($result, 0, 3) == 2) { $message .= $hc_lang_sendtofriend['TBA']; } $message .= '<br /><a href="' . CalRoot . '/index.php?eID=' . $eID . '">' . CalRoot . '/index.php?eID=' . $eID . '</a></p>'; } else {
/** * Output an event list. Writes list cache file if not currently available. * @since 2.0.0 * @version 2.0.2 * @param integer $type list to output, 0 = Billboard Events, 1 = Most Popular Events, 2 = Newest Events (Default:0) * @param integer $eTime [optional] 0 = do NOT include end time, 1 = include end time in list (Default:0) * @return void */ function event_list($type = 0, $eTime = 0) { global $hc_cfg, $hc_lang_event; $bQuery = $uQuery = ''; switch ($type) { case 0: $cf = 'list' . SYSDATE . '_0'; $noList = $hc_lang_event['NoBillboard']; $sQuery = 'e.PkID, e.Title, e.StartDate, e.StartTime, e.IsBillboard, e.SeriesID, e.TBD, e.EndTime'; $bQuery = $hc_cfg[13] == 0 ? ' AND e.IsBillboard = 1 ' : ''; $oQuery = ' ORDER BY IsBillboard DESC, StartDate, StartTime, Title LIMIT ' . $hc_cfg[12]; break; case 1: $cf = 'list' . SYSDATE . '_1'; $noList = $hc_lang_event['NoPopular']; $sQuery = 'e.PkID, e.Title, e.StartDate, e.StartTime, e.IsBillboard, e.SeriesID, e.TBD, e.EndTime, (e.Views / (DATEDIFF(\'' . SYSDATE . '\', e.PublishDate)+1)) as Ave'; $oQuery = ' ORDER BY AVE DESC, StartDate LIMIT ' . $hc_cfg[10]; break; case 2: $cf = 'list' . SYSDATE . '_2'; $noList = $hc_lang_event['NoNewest']; $sQuery = 'e.PkID, e.Title, e.StartDate, e.StartTime, e.IsBillboard, e.SeriesID, e.TBD, e.EndTime, e.PublishDate'; $oQuery = ' ORDER BY PublishDate DESC, StartDate LIMIT ' . $hc_cfg[66]; break; default: return 0; } if (!file_exists(HCPATH . '/cache/' . $cf)) { purge_cache_list($type); ob_start(); $fp = fopen(HCPATH . '/cache/' . $cf, 'w'); $uQuery = $hc_cfg[33] == 0 ? " AND SeriesID IS NULL \r\n\t\t\t\t\tUNION \r\n\t\t\t\t\tSELECT " . $sQuery . " FROM " . HC_TblPrefix . "events e\r\n\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "events e2 ON (e.SeriesID = e2.SeriesID AND e2.StartDate > '" . SYSDATE . "' AND e.StartDate > e2.StartDate)\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\te2.StartDate IS NULL AND \r\n\t\t\t\t\t\te.IsActive = 1 AND e.IsApproved = 1 AND e.StartDate >= '" . SYSDATE . "' AND e.SeriesID IS NOT NULL " . $bQuery . "\r\n\t\t\t\t\tGROUP BY e.SeriesID, e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD, e.IsBillboard, e.Views, e.PublishDate" : ''; $curDate = $cnt = 0; $showHeader = $type == 0 ? 0 : 1; $result = doQuery("SELECT " . $sQuery . " FROM " . HC_TblPrefix . "events e WHERE e.IsActive = 1 AND e.IsApproved = 1 AND e.StartDate >= '" . cIn(SYSDATE) . "'" . $bQuery . $uQuery . $oQuery); if (!hasRows($result)) { echo $noList; } else { echo ' <ul>'; while ($row = mysql_fetch_row($result)) { if ($row[4] == 0 && $showHeader == 0) { $showHeader = 1; echo ' <li class="upcoming">' . $hc_lang_event['Upcoming'] . '</li>'; } if ($curDate != $row[2]) { $curDate = $row[2]; echo ' <li class="date">' . stampToDate($row[2], $hc_cfg[14]) . '</li>'; } if ($row[6] == 0 && $hc_cfg[15] == 1) { $time = $row[3] != '' ? stampToDate($row[3], $hc_cfg[23]) : ''; $time .= $eTime == 1 && $row[7] != '' ? ' - ' . stampToDate($row[7], $hc_cfg[23]) : ''; } elseif ($row[6] > 0 && $hc_cfg[15] == 1) { $time = $row[6] == 1 ? $hc_lang_event['AllDay'] : $hc_lang_event['TBA']; } echo ' <li><a href="' . CalRoot . '/index.php?eID=' . $row[0] . '">' . cOut($row[1]) . '</a> ' . $time . '</li>'; ++$cnt; } echo ' </ul>'; } fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } include HCPATH . '/cache/' . $cf; }
<?php /** * @package Helios Calendar * @license GNU General Public License version 2 or later; see LICENSE */ define('isHC', true); define('isAction', true); include dirname(__FILE__) . '/loader.php'; action_headers(); post_only(); $target = CalRoot; $uID = isset($_POST['uID']) && is_numeric($_POST['uID']) ? cIn(strip_tags($_POST['uID'])) : 0; $result = doQuery("SELECT PkID FROM " . HC_TblPrefix . "users WHERE PkID = '" . $uID . "'"); if (!user_check_status() || !hasRows($result)) { session_destroy(); } else { $email = isset($_POST['email']) ? cIn(htmlentities(strip_tags($_POST['email']))) : ''; $email = preg_match('/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/', $email) == 1 ? $email : ''; $birthdate = isset($_POST['birthdate']) ? cIn(dateToMySQL(htmlentities(strip_tags($_POST['birthdate'])), $hc_cfg[24])) : ''; $birthdate = strtotime($birthdate) <= strtotime('-13 years') ? $birthdate : ''; $location = isset($_POST['user_loc']) ? cIn(htmlentities(strip_tags($_POST['user_loc']))) : ''; $api_key = isset($_POST['regen_apik']) ? ", APIKey = '" . cIn(md5(sha1($email . $birthdate . $location . rand() * date("U")))) . "' " : ''; doQuery("UPDATE " . HC_TblPrefix . "users SET Email = '" . $email . "', Birthdate = '" . $birthdate . "', Location = '" . $location . "'{$api_key} WHERE PkID = '" . $uID . "'"); if ($email != '' && $birthdate != '') { if (isset($_SESSION['new_user'])) { unset($_SESSION['new_user']); } if (isset($_SESSION['new_user_bday'])) { unset($_SESSION['new_user_bday']); }
<?php /** * @package Helios Calendar * @license GNU General Public License version 2 or later; see LICENSE */ define('isHC', true); define('isAction', true); include dirname(__FILE__) . '/loader.php'; action_headers(); $GUID = isset($_GET['a']) ? cIn(strip_tags($_GET['a'])) : ''; $result = doQuery("SELECT * FROM " . HC_TblPrefix . "subscribers WHERE GUID = '" . $GUID . "'"); if (hasRows($result) && mysql_result($result, 0, 6) == 0) { doQuery("UPDATE " . HC_TblPrefix . "subscribers SET IsConfirm = 1 WHERE PkID = '" . cIn(mysql_result($result, 0, 0)) . "'"); header('Location: ' . CalRoot . "/index.php?com=signup&t=3"); } else { header('Location: ' . CalRoot . '/'); }
} //--> </script>'; } else { $token = ''; $token = $token == '' && isset($_POST['token']) ? cIn(strip_tags($_POST['token'])) : $token; $token = $token == '' && isset($_GET['tkn']) ? cIn(strip_tags($_GET['tkn'])) : $token; appInstructions(1, "Merging_Locations", $hc_lang_locations['TitleMerge'], $hc_lang_locations['InstructMerge2']); $locName = ''; if (isset($_GET['l'])) { $locName = isset($_GET['l']) ? strip_tags(str_replace("'", "\"", $_GET['l'])) : ''; } elseif (isset($_POST['locName'])) { $locName = isset($_POST['locName']) ? strip_tags(str_replace("'", "\"", $_POST['locName'])) : ''; } $result = doQuery("SELECT PkID, Name, IsPublic, \r\n\t\t\t\t\t\t\t(SELECT COUNT(PkID) FROM " . HC_TblPrefix . "events e WHERE e.StartDate >= '" . SYSDATE . "' AND e.LocID = l.PkID) AS EventCnt\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "locations l\r\n\t\t\t\t\t\tWHERE IsActive = 1 AND\r\n\t\t\t\t\t\t\t(MATCH(Name,Address,Address2) AGAINST('" . cIn($locName, 0) . "' IN BOOLEAN MODE) OR NAME LIKE('%" . cIn($locName) . "%'))\r\n\t\t\t\t\t\tORDER BY IsPublic, Name"); if (!hasRows($result) || $locName == '' || !check_form_token($token)) { echo ' <p>' . $hc_lang_locations['NoLoc'] . '</p> <p><a href="' . AdminRoot . '/index.php?com=locsearch">' . $hc_lang_locations['NoLocLink'] . '</a></p>'; } else { echo ' <form name="frmMergeLocation" id="frmMergeLocation" method="post" action="' . AdminRoot . '/index.php?com=location&m=1" onsubmit="return validate();">'; set_form_token(); echo ' <div class="catCtrl"> [ <a href="javascript:;" onclick="checkAllArray(\'frmMergeLocation\',\'locID[]\');">' . $hc_lang_core['SelectAll'] . '</a> | <a href="javascript:;" onclick="uncheckAllArray(\'frmMergeLocation\',\'locID[]\');">' . $hc_lang_core['DeselectAll'] . '</a> ] </div> <ul class="data"> <li class="row header uline"> <div style="width:65%;">' . $hc_lang_locations['NameLabel'] . '</div>
/** * Builds newletter template using the assigned template replacing universal variables with their content. * * @param int $nID Newsletter ID * @return string */ function buildUniversal($nID) { global $hc_lang_news, $hc_cfg; $tmplCache = HCPATH . '/cache/news' . date("ymd") . '_' . $nID . '.txt'; if (!file_exists($tmplCache)) { foreach (glob(HCPATH . '/cache/news*_' . $nID . '.txt') as $filename) { unlink($filename); } $result = doQuery("SELECT tn.TemplateSource, n.Message, n.IsArchive\r\n\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "newsletters n\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "templatesnews tn ON (n.TemplateID = tn.PkID)\r\n\t\t\t\t\t\t\tWHERE n.PkID = '" . $nID . "' AND n.IsActive = 1 AND tn.IsActive = 1"); $template = $message = $archive = ''; $doArchive = 0; if (hasRows($result)) { $template = cOut(mysql_result($result, 0, 0)); $message = cOut(mysql_result($result, 0, 1)); $doArchive = cOut(mysql_result($result, 0, 2)); $archive = CalRoot . '/newsletter/index.php?n=' . md5($nID); } else { stopError($hc_lang_news['Err01']); } $template = str_replace('[message]', $message, $template); if (stristr($template, '[billboard]')) { $query = "SELECT PkID, Title, StartDate, StartTime, IsBillboard, SeriesID, TBD, EndTime FROM " . HC_TblPrefix . "events WHERE IsActive = 1 AND IsApproved = 1 AND StartDate >= '" . SYSDATE . "' AND IsBillboard = 1 ORDER BY IsBillboard DESC, StartDate, StartTime, Title LIMIT " . $hc_cfg[12]; $template = str_replace('[billboard]', getEventList($query), $template); } if (stristr($template, '[popular]')) { $query = "SELECT PkID, Title, StartDate, StartTime, IsBillboard, SeriesID, TBD, EndTime, (Views / (DATEDIFF('" . SYSDATE . "', PublishDate)+1)) as Ave FROM " . HC_TblPrefix . "events WHERE IsActive = 1 AND IsApproved = 1 AND StartDate >= '" . SYSDATE . "' ORDER BY Ave DESC, StartDate, StartTime, Title LIMIT " . $hc_cfg[10]; $template = str_replace('[popular]', getEventList($query), $template); } if (stristr($template, '[newest]')) { $query = "SELECT PkID, Title, StartDate, StartTime, IsBillboard, SeriesID, TBD, EndTime FROM " . HC_TblPrefix . "events WHERE IsActive = 1 AND IsApproved = 1 AND StartDate >= '" . SYSDATE . "' ORDER BY PublishDate DESC, StartDate LIMIT " . $hc_cfg[66]; $template = str_replace('[newest]', getEventList($query), $template); } if (stristr($template, '[updated]')) { $query = "SELECT PkID, Title, StartDate, StartTime, IsBillboard, SeriesID, TBD, EndTime FROM " . HC_TblPrefix . "events WHERE IsActive = 1 AND IsApproved = 1 AND StartDate >= '" . SYSDATE . "' ORDER BY LastMod DESC, StartDate LIMIT " . $hc_cfg[66]; $template = str_replace('[updated]', getEventList($query), $template); } if (stristr($template, '[today]')) { $query = "SELECT PkID, Title, StartDate, StartTime, IsBillboard, SeriesID, TBD, EndTime FROM " . HC_TblPrefix . "events WHERE IsActive = 1 AND IsApproved = 1 AND StartDate = '" . SYSDATE . "' ORDER BY StartDate, StartTime, Title LIMIT " . $hc_cfg[12]; $template = str_replace('[today]', getEventList($query), $template); } if (stristr($template, '[twitter]')) { $template = str_replace('[twitter]', '<a href="http://twitter.com/share?url=' . urlencode($archive) . '" target="_blank"><img src="' . CalRoot . '/newsletter/images/twitter.png" style="border:0px;" /></a>', $template); } if (stristr($template, '[facebook]')) { $template = str_replace('[facebook]', '<a href="http://www.facebook.com/sharer.php?u=' . urlencode($archive) . '" target="_blank"><img src="' . CalRoot . '/newsletter/images/facebook.png" style="border:0px;" /></a>', $template); } if (stristr($template, '[follow]')) { $follow = $hc_cfg[63] != '' ? '<a href="http://www.twitter.com/' . $hc_cfg[63] . '" target="_blank"><img src="' . CalRoot . '/newsletter/images/follow_me.png" style="border:0px;" /></a>' : ''; $template = str_replace('[follow]', $follow, $template); } if (stristr($template, '[calendarurl]')) { $template = str_replace('[calendarurl]', '<a href="' . CalRoot . '/" target="_blank">' . CalRoot . '/</a>', $template); } if (stristr($template, '[editcancel]')) { $template = str_replace('[editcancel]', '<a href="' . CalRoot . '/index.php?com=edit" target="_blank">' . $hc_lang_news['EditLinkTxt'] . '</a>', $template); } if (stristr($template, '[archive]')) { $template = $doArchive == 1 ? str_replace('[archive]', '<a href="' . $archive . '" target="_blank">' . $hc_lang_news['ArchiveLinkTxt'] . '</a>', $template) : str_replace('[archive]', '', $template); } if (stristr($template, '[event-count]')) { $result = doQuery("SELECT COUNT(*) FROM " . HC_TblPrefix . "events WHERE IsActive = 1 AND IsApproved = 1 AND StartDate >= '" . cIn(SYSDATE) . "'"); $eCnt = hasRows($result) ? number_format(mysql_result($result, 0, 0), 0, '.', ',') : 0; $template = str_replace('[event-count]', $eCnt, $template); } if (stristr($template, '[location-count]')) { $result = doQuery("SELECT COUNT(*) FROM " . HC_TblPrefix . "locations WHERE IsActive = 1"); $lCnt = hasRows($result) ? number_format(mysql_result($result, 0, 0), 0, '.', ',') : 0; $template = str_replace('[location-count]', $lCnt, $template); } if (stristr($template, '[track]')) { $template = str_replace('[track]', '<img src="' . CalRoot . '/newsletter/a.php?a=' . md5($nID) . '" width="1" height="1" />', $template); } ob_flush(); ob_start(); $fp = fopen($tmplCache, 'w'); echo $template; fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } return includeToString(realpath($tmplCache)); }
<?php /** * @package Helios Calendar * @license GNU General Public License version 2 or later; see LICENSE */ if (!defined('hcAdmin')) { header("HTTP/1.1 403 No Direct Access"); exit; } $errorMsg = ''; $result = doQuery("SELECT * FROM " . HC_TblPrefix . "settings WHERE PkID IN(5,6);"); if (!hasRows($result)) { $apiFail = true; $errorMsg = 'Eventbrite API Settings Unavailable.'; } else { $ebAPI = cOut(mysql_result($result, 0, 1)); $ebUser = cOut(mysql_result($result, 1, 1)); if ($ebAPI == '' || $ebUser == '') { $apiFail = true; $errorMsg = 'Eventbrite API Settings Missing.'; } else { $ebSend = "/xml/payment_update?app_key=" . $ebAPI . "&user_key=" . $ebUser; $ebSend .= "&event_id=" . $ebID; if (isset($_POST['ebPaypal']) && $hc_cfg[103] != '') { $ebSend .= "&accept_paypal=1"; $ebSend .= "&paypal_email=" . $hc_cfg[103]; } else { $ebSend .= "&accept_paypal=0"; } if (isset($_POST['ebGoogleC']) && $hc_cfg[104] != '' && $hc_cfg[105] != '') {
$editEvent = mysql_result($result, 0, 7); $eventPending = mysql_result($result, 0, 8); $eventCategory = mysql_result($result, 0, 9); $userEdit = mysql_result($result, 0, 10); $adminEdit = mysql_result($result, 0, 11); $newsletter = mysql_result($result, 0, 12); $settings = mysql_result($result, 0, 13); $tools = mysql_result($result, 0, 14); $reports = mysql_result($result, 0, 15); $locEdit = mysql_result($result, 0, 16); $pages = mysql_result($result, 0, 17); $notices = array_filter(explode(',', mysql_result($result, 0, 18)), 'is_numeric'); $fails = mysql_result($result, 0, 19); $active = $_SESSION['AdminPkID'] == $aID ? ' disabled="disabled"' : ''; $resultH = doQuery("SELECT * FROM " . HC_TblPrefix . "adminloginhistory WHERE AdminID = '" . $aID . "' ORDER BY LoginTime DESC LIMIT 100"); if (hasRows($resultH)) { $login_history .= ' <ul class="data">'; $cnt = 0; while ($row = mysql_fetch_row($resultH)) { $hl = $cnt % 2 == 1 ? ' hl' : ''; $login_history .= ' <li class="row' . $hl . ($row[5] == 1 ? ' error' : '') . '"> <div style="width:25%;">' . stampToDate($row[4], $hc_cfg[24] . ' ' . $hc_cfg[23]) . '</div> <div style="width:18%;">' . cOut($row[2]) . '</div> <div class="txt" title="' . cOut($row[3]) . '" style="width:55%;">' . cOut($row[3]) . '</div> </li>'; ++$cnt; } $login_history .= '
feedback(1, $hc_lang_admin['Feed03']); break; case "2": feedback(3, $hc_lang_admin['Feed04']); break; case "3": feedback(1, $hc_lang_admin['Feed05']); break; case "4": feedback(1, $hc_lang_admin['Feed06']); break; } } appInstructions(0, "Editing_Admin_Users", $hc_lang_admin['TitleBrowseA'], $hc_lang_admin['InstructBrowseA']); $result = doQuery("SELECT PkID, FirstName, LastName, Email, LastLogin FROM " . HC_TblPrefix . "admin WHERE IsActive = 1 AND SuperAdmin = 0 ORDER BY LastName, FirstName"); if (hasRows($result)) { echo ' <ul class="data"> <li class="row header uline"> <div style="width:30%;">' . $hc_lang_admin['Name'] . '</div> <div style="width:40%;">' . $hc_lang_admin['EmailLabel'] . '</div> <div style="width:20%;">' . $hc_lang_admin['Login'] . '</div> <div style="width:10%;"> </div> </li>'; $cnt = 0; while ($row = mysql_fetch_row($result)) { $hl = $cnt % 2 == 1 ? ' hl' : ''; echo ' <li class="row ' . $hl . '"> <div class="txt" style="width:30%;">' . cOut($row[2] . ', ' . $row[1]) . '</div> <div class="txt" style="width:40%;">' . cOut($row[3]) . '</div>
* @package Helios Calendar * @license GNU General Public License version 2 or later; see LICENSE */ if (!defined('hcAdmin')) { header("HTTP/1.1 403 No Direct Access"); exit; } include HCLANG . '/admin/locations.php'; $hc_Side[] = array(CalRoot . '/index.php?com=location', 'map.png', $hc_lang_locations['LinkMap'], 1); $locIDs = isset($_POST['locID']) ? implode(',', array_filter($_POST['locID'], 'is_numeric')) : ''; $token = ''; $token = $token == '' && isset($_POST['token']) ? cIn(strip_tags($_POST['token'])) : $token; $token = $token == '' && isset($_GET['tkn']) ? cIn(strip_tags($_GET['tkn'])) : $token; appInstructions(1, "Merging_Locations", $hc_lang_locations['TitleMerge'], $hc_lang_locations['InstructMerge3']); $result = doQuery("SELECT PkID, Name, IsPublic, \r\n\t\t\t\t\t\t(SELECT COUNT(PkID) FROM " . HC_TblPrefix . "events e WHERE e.StartDate >= '" . cIn(SYSDATE) . "' AND e.LocID = l.PkID) AS EventCnt\r\n\t\t\t\t\tFROM " . HC_TblPrefix . "locations l\r\n\t\t\t\t\tWHERE IsActive = 1 AND PkID IN (" . $locIDs . ")\r\n\t\t\t\t\tORDER BY IsPublic, Name"); if (hasRows($result) && check_form_token($token)) { echo ' <form name="frmMergeLocation" id="frmMergeLocation" method="post" action="' . AdminRoot . '/components/LocationMergeAction.php" onsubmit="return validate();">'; set_form_token(); echo ' <input type="hidden" name="locIDs" id="locIDs" value="' . $locIDs . '" /> <ul class="data"> <li class="row header uline"> <div style="width:65%;">' . $hc_lang_locations['NameLabel'] . '</div> <div style="width:15%;">' . $hc_lang_locations['StatusLabel'] . '</div> <div class="number" style="width:10%;">' . $hc_lang_locations['Events'] . '</div> <div style="width:10%;"> </div> </li>'; $cnt = 0; while ($row = mysql_fetch_row($result)) { $hl = $cnt % 2 == 1 ? ' hl' : '';
$query .= ", c.CategoryName"; break; } switch ($sortBy) { case 0: $query .= " ORDER BY c.CategoryName, e.StartDate, e.Title"; break; case 1: $query .= " ORDER BY e.StartDate, c.CategoryName, e.Title"; break; case 2: $query .= " ORDER BY e.StartDate, e.Title"; break; } $resultE = doQuery($query); if (hasRows($resultE)) { $export = buildIt($header, NULL); while ($row = mysql_fetch_row($resultE)) { $export .= buildIt($content, $row); } $export .= buildIt($footer, NULL); $clean = str_replace($cleanUp, "", $export); $clean = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $clean); $clean = str_replace("|N", "\n", $clean); echo $clean; } else { exit($hc_lang_tools['NoExport']); } } else { exit($hc_lang_tools['NoExport']); }
/** * Output wall calendar style monthly mini-calendar. Writes cache files if not currently available. * @since 2.0.0 * @version 2.0.0 * @param string $date [optional] calendar month to create (Default: current browse date) * @return void */ function ou_mini_cal_month($date = '') { global $lID, $favQ1, $favQ2, $hc_cfg, $hc_lang_config; $year = HCYEAR; $month = HCMONTH; if ($date != '') { $year = date("Y", strtotime($date)); $month = date("m", strtotime($date)); } if (!file_exists(HCPATH . '/cache/mcal_' . $year . '_' . $month)) { ob_start(); $fp = fopen(HCPATH . '/cache/mcal_' . $year . '_' . $month, 'w'); $stopDay = date("t", mktime(0, 0, 0, $month, 1, $year)); $locSaver = $lQuery = $opts = $dow = ''; $events = array(); $result = doQuery("SELECT DISTINCT e.StartDate\r\n\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "events e\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (ec.EventID = e.PkID)\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "locations l ON (e.LocID = l.PkID)\r\n\t\t\t\t\t\t\tWHERE e.StartDate BETWEEN '" . date("Y-m-d", mktime(0, 0, 0, $month, 1, $year)) . "' AND '" . date("Y-m-d", mktime(0, 0, 0, $month + 1, 0, $year)) . "'\r\n\t\t\t\t\t\t\tAND e.IsActive = 1 AND e.IsApproved = 1\r\n\t\t\t\t\t\t\tORDER BY e.StartDate"); if (hasRows($result)) { while ($row = mysql_fetch_row($result)) { $events[] = stampToDate($row[0], $hc_cfg[93]); } } $navBack = date("Y-m-d", mktime(0, 0, 0, $month - 1, 1, $year)); $navFrwd = date("Y-m-d", mktime(0, 0, 0, $month + 1, 1, $year)); $bak = $hc_cfg['First'] > strtotime(HCDATE) || HCDATE <= SYSDATE && $hc_cfg[11] == 0 ? '<a href="#" rel="nofollow"><</a>' : '<a href="' . CalRoot . '/?d=' . $navBack . $locSaver . '" rel="nofollow"><</a>'; $fwd = $hc_cfg['Last'] > strtotime($navFrwd) ? '<a href="' . CalRoot . '/?d=' . $navFrwd . $locSaver . '" rel="nofollow">></a>' : '<a href="#" rel="nofollow">></a>'; $jmp = $hc_cfg[11] == 1 ? 12 : 0; $stop = $jmp + 12; $jumpMonth = date("n", mktime(0, 0, 0, $month - $jmp, 1, $year)); $jumpYear = date("Y", mktime(0, 0, 0, $month - $jmp, 1, $year)); $sysDay = date("d", strtotime(SYSDATE)); $sysMonth = date("m", strtotime(SYSDATE)); $sysYear = date("y", strtotime(SYSDATE)); $actJump = date("Y-m-d", mktime(0, 0, 0, $month, 1, $year)); $i = 0; while ($i <= $stop) { $jmpDate = date("Y-m-d", mktime(0, 0, 0, $jumpMonth + $i, 1, $jumpYear)); $select = $jmpDate == $actJump ? ' selected="selected"' : ''; $opts .= ' <option value="' . CalRoot . '/?d=' . $jmpDate . $locSaver . '&b=1"' . $select . '>' . strftime($hc_cfg[92], mktime(0, 0, 0, $jumpMonth + $i, 1, $jumpYear)) . '</option>'; ++$i; } $i = 0; while ($i < 7) { $dow .= ' <td class="dow">' . $hc_lang_config['MiniCalDays'][($hc_cfg[22] + $i) % 7] . '</td>'; ++$i; } echo ' <form name="frmJump" id="frmJump" action="#"> <table class="mini-cal table table-bordered"> <tr> <td class="nav">' . $bak . '</td> <td class="title" colspan="5"> <select name="jumpMonth" id="jumpMonth" onchange="window.location.href=this.value;">' . $opts . ' </select> </td> <td class="nav">' . $fwd . '</td> </tr> <tr> ' . $dow . ' </tr> <tr>'; $i = 0; $fillCnt = (date("w", mktime(0, 0, 0, $month, 1, $year)) - $hc_cfg[22] + 7) % 7; while ($i < $fillCnt) { echo ' <td class="blank"> </td>'; ++$i; } $i = 1; while ($i <= $stopDay) { echo $i > 1 && ($i + $fillCnt) % 7 == 1 ? ' </tr> <tr>' : ''; if (in_array($i, $events)) { $cell = SYSDATE == date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) ? 'today' : 'events'; echo ' <td class="' . $cell . '"><a href="' . CalRoot . '/index.php?d=' . $year . '-' . $month . '-' . $i . '&m=1' . $locSaver . '" rel="nofollow">' . strftime($hc_cfg[93], mktime(0, 0, 0, $month, $i, $year)) . '</a></td>'; } else { $cell = SYSDATE == date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) ? 'today' : 'empty'; echo ' <td class="' . $cell . '">' . strftime($hc_cfg[93], mktime(0, 0, 0, $month, $i, $year)) . '</td>'; } ++$i; } $i = ($i + $fillCnt - 1) % 7; while ($i < 7 && $i != 0) { echo ' <td class="blank"> </td>'; ++$i; } echo ' </tr> </table> </form>'; fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } include HCPATH . '/cache/mcal_' . $year . '_' . $month; }