本文整理汇总了PHP中hasRows函数的典型用法代码示例。如果您正苦于以下问题:PHP hasRows函数的具体用法?PHP hasRows怎么用?PHP hasRows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hasRows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: location_events
/**
* 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>';
}
示例2: api_user_authenticate
/**
* 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;
}
}
示例3: ou_event_carousel
/**
* 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';
}
示例4: startNewSession
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 . "'");
}
示例5: go_home
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);
示例6: int_week_dashboard
/**
* 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>';
}
示例7: header
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>
示例8: header
*/
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=" . $bitlyUser . "&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;
示例9: isset
$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);
示例10: define
/**
* @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");
示例11: cOut
$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 : "/xml/event_update?app_key=" . $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;
示例12: user_update_status
/**
* 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();
}
}
示例13: sr_news_link_archive
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>';
}
}
示例14: doQuery
}
//-->
</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);
示例15: map_locations
/**
* 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;
}