function ldapTimeToNormalTime($ldapTime) { if ($ldapTime == 0) { return "Never"; } // divide by 10.000.000 to get seconds from 100-nanosecond intervals $winInterval = round($ldapTime / 10000000); // substract seconds from 1601-01-01 -> 1970-01-01 $unixTimestamp = $winInterval - 11644473600; return showtime($unixTimestamp); }
function day($ask, $date) { global $EVENTS_TB, $CAT_TB, $USER_TB, $mth, $week, $m, $d, $y, $viewweekok, $viewcalok, $viewdayok, $allowsearch, $searchdayok, $popupevent, $popupeventwidth, $popupeventheight, $calstartyear, $caladvanceyear, $addeventok, $userview, $userlogin, $userid, $addeventwin_w, $addeventwin_h, $shortdesclen, $catview, $ugroup, $uname, $showuserentry, $publicview, $dayview_w, $notimeentry; if (!isset($yda)) { $yda = ''; } if ($viewdayok == 1) { if (!$date) { $year = $y; $month = $m; $day = $d; } else { $year = substr($date, 0, 4); $month = substr($date, 5, 2); $day = substr($date, 8, 2); } $we = mktime(0, 0, 0, $month, $day, $year); $we = strftime("%w", $we); $we++; // variables with exact digit without the leading 0 used for query and accessing array $vdm = $month; if (substr($vdm, 0, 1) == "0") { $vdm = str_replace("0", "", $vdm); } $vda = $day; if (substr($vda, 0, 1) == "0") { $vda = str_replace("0", "", $vda); } $weeknumber = weekNumber($day, $month, $year); if ($year > $y + $caladvanceyear) { $weeknumber = 53; } // to ensure weeks cannot go beyond restricted dates if ($year < $calstartyear) { $weeknumber = 1; } // to ensure weeks cannot go beyond restricted dates echo "<table border=0 width={$dayview_w} cellspacing=0 align=center class=headerfont><tr><td align=left>" . translate("Events for day"); echo ": " . $week[$we] . " " . $day . " "; if ($year <= $y + $caladvanceyear && $year >= $calstartyear) { if ($viewcalok == 1) { echo "<a class=headerfont href='calendar.php?op=cal&month=" . $vdm . "&year=" . $year . "&catview={$catview}'>"; } } echo $mth[$vdm]; if ($year <= $y + $caladvanceyear && $year >= $calstartyear) { if ($viewcalok == 1) { echo "</a>"; } } echo " " . $year . " "; if ($viewweekok == 1) { echo "<a href='cal_week.php?op=week&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)) . "&catview={$catview}'><img src=\"images/week.gif\" border=0 alt='" . translate("View week") . " {$weeknumber}" . "' width=16 height=16/></a>"; } $weekday = date("w", mktime(12, 0, 0, $vdm, $vda, $year)); $weekday++; if ($publicview == 1 && $uname != "" || $publicview == 0) { if ($addeventok == 1) { echo " <a href='#{$week[$weekday]}' onclick=\"Javascript:wopen('cal_addevent.php?op=eventform&add_day={$day}&add_month={$month}&add_year={$year}&catview={$catview}','popupwin'," . $addeventwin_w . "," . $addeventwin_h . ",'yes');\"><img src='images/plus.gif' border=0 valign=middle alt='" . translate("Add Event") . "' width=11 height=11/></a>"; } } echo "</td>"; echo "<td align=right><div class=menufont>"; // display previous day and next day navigation if ($year > $calstartyear || $vdm > 1 && $year == $calstartyear || $vdm == 1 && $year == $calstartyear && $vda > 1) { echo "<a href=\"cal_day.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day - 1, $year)) . "&catview={$catview}\r\n\"><< " . translate("Previous day") . "</a> "; } else { echo " "; } $calendyear = $y + $caladvanceyear; if ($year < $calendyear || $vdm < 12 && $year == $calendyear || $vdm == 12 && $year == $calendyear && $vda < 31) { echo "<a href=\"cal_day.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day + 1, $year)) . "&catview={$catview}\">" . translate("Next day") . " >></a> <br/>"; } else { echo " "; } echo "</div></td></tr></table>"; $query = "select id,user,title,description,url,email,cat_name,starttime,endtime,day,month,year from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where day='{$vda}' and month='{$vdm}' and year='{$year}' and approved='1'"; if ($catview != 0) { $query = $query . " and " . $EVENTS_TB . ".cat={$catview}"; } if ($userview == 1 && $userlogin == 1) { // user view user specific events only if ($ugroup != 0) { $query = $query . " and user='******'"; } } $query = $query . " order by starttime,title ASC"; $result = mysql_query($query); echo "<table width={$dayview_w} class=dayevent cellspacing=0 align=center><tr><td align=left>"; if (mysql_num_rows($result) != 0) { while ($row = mysql_fetch_object($result)) { if ($notimeentry == 0) { if ($row->starttime == '') { echo "<li>"; } else { showtime($row->starttime, $row->endtime, 0); } } else { echo "<li>"; } echo "<b>"; echo stripslashes($row->title); if ($showuserentry == 1 && $uname != "") { echo " <" . $row->user . ">"; } echo "</b>"; if ($notimeentry == 1 || $row->starttime == '') { echo "</li>"; } else { echo "<br/>"; } echo translate("Category") . " : " . stripslashes($row->cat_name) . "<br/>"; $de = $row->description; // $de = str_replace("<br />","",$row->description); echo substr(stripslashes($de), 0, $shortdesclen); if ($row->email != "" || $row->url != "" || strlen($de) > $shortdesclen) { echo " ...\n"; } else { echo "\n"; } echo "<br/>"; if ($popupevent == 1) { echo "<div class=menufont><a href=\"Javascript:void(0);\" onclick=\"Javascript:popup(" . $row->id . ");\">"; } else { echo "<div class=menufont><a href=cal_event.php?id=" . $row->id . ">"; } echo translate("Read more") . "</a></div>"; echo "<hr/>"; } } else { echo " <br/>"; } echo "</td></tr></table>"; // this is for the goto day redirection javascript echo "<script language=\"JavaScript\" type=\"text/JavaScript\">\n"; echo "\tfunction gotoday(selectopt) {\n"; echo "var geti = '1' ;\n"; echo "for (i=0;i<selectopt.options.length;i++) {\n"; echo "\tif (selectopt.options[i].selected) {\n"; echo "\t\tgeti = selectopt.options[i].value ;\n"; echo "\t\tbreak ;\n"; echo "\t}\n"; echo "}\n\n"; echo "\t\tswitch (geti) { \n"; $dateinmonth = date("t", mktime(0, 0, 0, $month, $day, $year)); for ($i = 1; $i <= $dateinmonth; ++$i) { echo "case \"" . $i . "\" : { window.location.href='cal_day.php?op=day&date="; echo date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)); echo "&catview={$catview}' ; break ;} \n"; } echo "default : { window.location.href='cal_day.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)) . "&catview={$catview}' ; break;} \n"; echo "\t\t}\n"; echo "\t}\n"; echo "</script>"; // display form functions echo "<table border=0 width={$dayview_w} align=center><tr><td align=left width=34%> </td>"; echo "<td align=center valign=middle width=33%>"; echo "<form><div class=menufont>\n"; echo "<b>" . translate("Go to day") . " </b>"; // get week number echo "<select name=goday onchange=\"javascript:gotoday(this);\""; if ($year > $y + $caladvanceyear || $year < $calstartyear) { echo " disabled"; } echo ">\n"; for ($i = 1; $i <= $dateinmonth; $i++) { echo "\t<option value=" . $i; if ($day == $i) { echo " selected "; } echo ">" . $i . "\n"; } echo "</select>\n"; if ($viewweekok == 1) { echo "<b>" . translate("or week") . " </b>"; // get week number echo "<select name=goweek onchange=\"javascript:gotoweek(this);\">\n"; for ($i = 1; $i < 53; $i++) { echo "\t<option value=" . $i; if ($weeknumber == $i) { echo " selected "; } echo ">" . $i . "\n"; } if (showWeek53($year) > 52) { for ($i = 53; $i <= showWeek53($year); $i++) { echo "\t<option value=" . $i; if ($weeknumber == $i) { echo " selected "; } echo ">" . $i . "\n"; } } echo "</select> \n"; } echo "</div></form>"; echo "</td>"; echo "<td align=right valign=middle width=33%>"; if ($allowsearch == 1 && $searchdayok == 1) { search(); } echo "</td></tr></table>"; } else { echo "<br/><div class=titlefont>" . translate("disabled") . ".</div>"; } }
<table border="1" width="100%" cellpadding="0" cellspacing="0"> <tr class="Karnaf_Head2"><td colspan="2">Replies</td></tr> <?php $query2 = squery("SELECT title,reply,r_time,r_from FROM karnaf_replies WHERE tid=%d ORDER BY r_time", $id); $cnt = 0; while ($result2 = sql_fetch_array($query2)) { $cnt++; ?> <tr class="Karnaf_P_Head"><td colspan="2">Reply #<?php echo $cnt; ?> from <?php echo $result2['r_from']; ?> at <?php echo showtime($result2['r_time']); ?> </td></tr> <tr> <td class="ticket_replies" colspan="2"> <?php if (!empty($result2['title'])) { echo "Title: "; show_board_body($result2['title']); echo "<hr>\n"; } echo show_board_body(preg_replace("/(\\*)?\\[image\\:\\sironSource\\](\\*)?.*Thank\\syou\\./s", "*** Signature ***", $result2['reply'])); ?> </td> </tr> <?php
echo ' <div class="post-list"> <div class="item-avatar"><a href="/user/', $article['uid'], '">'; if (!$is_spider) { echo '<img src="/avatar/large/', $article['uavatar'], '.png" alt="', $article['author'], '" />'; } else { echo '<img src="/static/grey.gif" data-original="/avatar/large/', $article['uavatar'], '.png" alt="', $article['author'], '" />'; } echo ' </a></div> <div class="item-content"> <h1><a rel="bookmark" href="/topics/', $article['id'], '">', $article['title'], '</a></h1> <span class="item-date"><i class="fa fa-archive"></i> <a href="/nodes/', $article['cid'], '">', $article['cname'], '</a> <i class="fa fa-user"></i> <a href="/user/', $article['uid'], '">', $article['author'], '</a>'; if ($article['comments']) { echo ' <i class="fa fa-clock-o"></i> <time datetime="', showtime2($article['edittime']), '" pubdate="pubdate" data-updated="true">', showtime($article['edittime']), '</time> <i class="fa fa-user-secret"></i> 最后回复来自 <a href="/user/', $article['ruid'], '">', $article['rauthor'], '</a>'; } else { echo ' <i class="fa fa-clock-o"></i> <time datetime="', showtime2($article['addtime']), '" pubdate="pubdate" data-updated="true">', showtime($article['addtime']), '</time>'; } echo ' </span> </div>'; if ($article['comments']) { $gotopage = ceil($article['comments'] / $options['commentlist_num']); if ($gotopage == 1) { $c_page = ''; } else { $c_page = '/' . $gotopage; } echo '<div class="item-count"><a href="/topics/', $article['id'], $c_page, '#reply', $article['comments'], '">', $article['comments'], '</a></div>'; } echo ' <div class="c"></div> </div>'; }
} else { $c_content = ''; } // 获取分类 $c_obj = $DBS->fetch_one_array("SELECT * FROM yunbbs_categories WHERE id='" . $t_obj['cid'] . "'"); // 获取评论 if ($t_obj['comments']) { if ($page == 0) { $page = 1; } $query_sql = "SELECT c.id,c.uid,c.addtime,c.content,u.avatar as avatar,u.name as author\n FROM yunbbs_comments c \n LEFT JOIN yunbbs_users u ON c.uid=u.id\n WHERE c.articleid='{$tid}' ORDER BY c.id ASC LIMIT " . ($page - 1) * $options['commentlist_num'] . "," . $options['commentlist_num']; $query = $DBS->query($query_sql); $commentdb = array(); while ($comment = $DBS->fetch_array($query)) { // 格式化内容 $comment['addtime'] = showtime($comment['addtime']); if ($is_spider || $tpl) { // 手机浏览和搜索引擎访问不用 jquery.lazyload $comment['content'] = set_content($comment['content'], 1); } else { $comment['content'] = set_content($comment['content']); } $commentdb[] = $comment; } unset($comment); $DBS->free_result($query); } // 增加浏览数 $DBS->unbuffered_query("UPDATE yunbbs_articles SET views=views+1 WHERE id='{$tid}'"); // 如果id在提醒里则清除 if ($cur_user && $cur_user['notic'] && strpos(' ' . $cur_user['notic'], $tid . ',')) {
include dirname(__FILE__) . '/config.php'; include dirname(__FILE__) . '/common.php'; if (!$cur_user || $cur_user['flag'] < 99) { exit('error: 403 Access Denied'); } $mid = intval($_GET['mid']); if ($mid == $cur_user['id']) { header('location: /setting'); exit; } $query = "SELECT * FROM yunbbs_users WHERE id='{$mid}'"; $m_obj = $DBS->fetch_one_array($query); if (!$m_obj) { exit('404'); } $m_obj['regtime'] = showtime($m_obj['regtime']); $tip1 = ''; $tip2 = ''; $tip3 = ''; $tip4 = ''; $av_time = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $action = $_POST['action']; if ($action == 'info') { $email = addslashes(filter_chr(trim($_POST['email']))); $url = char_cv(filter_chr(trim($_POST['url']))); $about = addslashes(trim($_POST['about'])); if ($DBS->unbuffered_query("UPDATE yunbbs_users SET email='{$email}', url='{$url}', about='{$about}' WHERE id='{$mid}'")) { //更新缓存 $m_obj['email'] = $email; $m_obj['url'] = $url;
echo "top.opener.window.location.reload();\n"; echo "window.close();\n"; echo "</script>\n\n"; } } $query = "select id,user,title,cat_name,description,starttime,endtime,day,month,year,approved,url,email from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where id='{$id}'"; $result = mysql_query($query); $row = mysql_fetch_object($result); echo "<div class=popupeventtitlefont>" . stripslashes($row->title) . "</div><br/>\n"; echo "\n<div class=popupeventfont>"; $weekday = mktime(0, 0, 0, $row->month, $row->day, $row->year); $weekday = strftime("%w", $weekday); $weekday++; echo "<b>" . translate("Date") . " : </b>" . $row->day . " " . $mth[$row->month] . " " . $row->year . " (" . $week[$weekday] . ")\n"; if ($notimeentry == 0) { showtime($row->starttime, $row->endtime, 2); } echo "<br/><b>" . translate("Category") . " : </b>" . stripslashes($row->cat_name) . "\n"; echo "<br/><br/><b>" . translate("Event Description") . " : </b><br/>\n"; echo "<blockquote>" . stripslashes($row->description) . "</blockquote>"; echo "\n"; if ($row->email) { echo "<br/><b>" . translate("Email") . " : </b><a href=mailto:" . $row->email . ">" . $row->email . "</a>\n"; } if ($row->url) { echo "<br/><b>" . translate("More info") . " : </b><a href="; // for compatibility with up to 0.5 version if (strtolower(substr($row->url, 0, 4)) != "http") { echo "http://" . $row->url . " target=_blank>http://" . $row->url . "</a>\n"; } else { echo $row->url . " target=_blank>" . $row->url . "</a>\n";
function cal($month, $year) { global $CAT_TB, $EVENTS_TB, $USER_TB, $mth, $week, $language, $m, $d, $y, $viewcalok, $viewweekok, $viewdayok, $searchmonthok, $popupevent, $popupeventwidth, $popupeventheight, $calstartyear, $caladvanceyear, $allowsearch, $weekstartday, $addeventok, $userview, $userlogin, $userid, $addeventwin_w, $addeventwin_h, $catview, $uname, $ugroup, $showuserentry, $publicview, $limitmthevt, $notimeentry, $overlibbgclr, $rssfeeds, $rssactive, $rssview; if (isset($rssview)) { $rsschannel = $rssfeeds[$rssview][0]; } else { $rsschannel = "None"; } if ($viewcalok == 1) { // previous month $pm = $month; if ($month == "1") { $pm = "12"; } else { $pm--; } // previous year $py = $year; if ($pm == "12") { $py--; } // next month $nm = $month; if ($month == "12") { $nm = "1"; } else { $nm++; } // next year $ny = $year; if ($nm == 1) { $ny++; } // get month we want to see $askedmonth = $mth[$month]; $askedyear = $year; $firstday = date("w", mktime(12, 0, 0, $month, 1, $year)); $firstday; // Check RSS Feed if ($rssactive == 1) { $RSSData = RSS(1, 1, 2007); } // number of days in askedmonth $nr = date("t", mktime(12, 0, 0, $month, 1, $year)); echo "\n\n<table class=monthview align=center>"; echo "<tr>"; echo "<td align=left colspan=2 class=monthview width='28%' valign=middle> "; if ($year > $calstartyear || $month > 1 && $year == $calstartyear) { echo "<a href=calendar.php?op=cal&month=" . $pm . "&year=" . $py . "&catview={$catview} class=calfontnav>" . $mth[$pm] . " " . $py . "</a>"; $pdate = date("Y-m-d", mktime(0, 0, 0, $month - 1, 1, $year)); echo " <a href='Javascript:void(0);' onclick=\"Javascript:wopen('smallcal.php?op=smallcal&date={$pdate}','popupmonth',350,220,'no');\">"; echo "<img src='images/smallcal.gif' border=0 alt='" . translate("Popup Month") . "' valign=middle width=16 height=16/></a>"; } else { echo " "; } echo "</td>"; echo "<td align=center colspan=3 class=monthview width='44%' >"; echo "<div class=calfontasked>" . $askedmonth . " "; echo " <a href='Javascript:void(0);' onclick=\"Javascript:wopen('yearcal.php?op=yearcal&ycyear={$askedyear}','popupyear',610,600,'yes');\" class=calfontasked>"; echo $askedyear . "</a></div>\n"; echo "<td align=right colspan=2 class=monthview width='28%'>"; $calendyear = $y + $caladvanceyear; if ($ny <= $calendyear) { $ndate = date("Y-m-d", mktime(0, 0, 0, $month + 1, 1, $year)); echo " <a href='Javascript:void(0);' onclick=\"Javascript:wopen('smallcal.php?op=smallcal&date={$ndate}','popupmonth',350,220,'no');\">"; echo "<img src='images/smallcal.gif' border=0 alt='" . translate("Popup Month") . "' valign=middle width=16 height=16/></a> "; echo "<a href=calendar.php?op=cal&month=" . $nm . "&year=" . $ny . "&catview={$catview} class=calfontnav>" . $mth[$nm] . " " . $ny . "</a>"; echo " "; } else { echo " "; } echo "</td></tr></table>\n\n"; echo "<table align=center class=monthview cellspacing=1>"; echo "<tr>"; // make the header days of week for ($i = intval($weekstartday) + 1; $i <= intval($weekstartday) + 7; $i++) { echo "<td align=center "; if (dayinweek($i) == 1) { echo "class=sundaytopcolor><div class=dayfont>" . $week[dayinweek($i)] . "</div></td>\n"; } else { echo "class=weekdaytopcolor><div class=dayfont>" . $week[dayinweek($i)] . "</div></td>\n"; } // rest of week } echo "</tr>\n\n<tr>\n"; // begin the days // print initial blank squares for ($i = 1; $i <= blankdays(intval($weekstartday), $firstday); $i++) { echo "<td "; if (dayinweek($i) == 1) { echo "class=sundayemptyclr "; } else { echo "class=weekdayemptyclr "; } echo "> </td>"; } $a = 0; for ($i = 1; $i <= $nr; $i++) { echo "<td "; if ($i == $d && $month == $m && $year == $y) { // highlight today's day echo "class=todayclr "; } else { if (date("w", mktime(0, 0, 0, $month, $i, $year)) == 0) { echo "class=sundayclr "; } else { echo "class=weekdayclr "; } } // click on date number to view events for the date echo " valign=top><table width='100%' border=0 cellspacing=1 cellpadding=1><tr><td align=left>"; echo "<b>"; if ($viewdayok == 1) { echo "<a class=datenumfont href='cal_day.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) . "&catview={$catview}'>"; } echo $i; if ($viewdayok == 1) { echo "</a>"; } echo "</b></td>"; echo "<td align=right> "; if (date("w", mktime(0, 0, 0, $month, $i, $year)) == $weekstartday) { if ($viewweekok == 1) { echo "<a href='cal_week.php?op=week&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) . "&catview={$catview}'><img src='images/week.gif' alt='" . translate("View week") . " " . weekNumber($i, $month, $year) . "' border=0 valign=middle width=11 height=11/></a> "; } } if ($publicview == 1 && $uname != "" || $publicview == 0) { if ($addeventok == 1) { echo "<a href='Javascript:void(0);' onclick=\"Javascript:wopen('cal_addevent.php?op=eventform&add_day={$i}&add_month={$month}&add_year={$year}&catview={$catview}','popupwin'," . $addeventwin_w . "," . $addeventwin_h . ",'yes');\"><img src='images/plus.gif' alt='" . translate("Add Event") . "' border=0 valign=middle width=11 height=11/></a>"; } } echo "</td></tr></table>"; // now get RSS events if ($rssactive == 1) { if (isset($RSSData[$i][$month][$year])) { echo "\n<table class=eventborder border=1 cellspacing=0 cellpadding=0 width=100%><tr><td align=center class=eventtimeborder valign=top>"; echo "\n<div class=smallcalev><b>"; // overlib line echo "<a href='Javascript:void(0);' onmouseover=\"return overlib('"; echo "<table border=0 cellspacing=0 cellpadding=0 width=100%>"; for ($j = 0; $j <= $RSSData[$i][$month][$year]['count']; $j++) { echo "<tr><td align=center valign=top>"; echo "<table class=eventborder border=1 cellspacing=0 cellpadding=0 width=100%><tr>"; if ($notimeentry == 0) { echo "<td align=center class=eventtimeborder valign=top>"; echo "<div class=smallcalevtime>"; if (isset($RSSData[$i][$month][$year][$j]['starttime'])) { if ($RSSData[$i][$month][$year][$j]['starttime'] == '') { echo " "; } else { showtime($RSSData[$i][$month][$year][$j]['starttime'], $RSSData[$i][$month][$year][$j]['endtime'], 1); } echo "</div>"; echo "</td>"; } } echo "<td align=left valign=top width=80% class=eventborder>"; echo "<div class=smallcalevtime>"; echo "<a class=smallcalev href=\\'" . $RSSData[$i][$month][$year][$j]['link'] . "\\' target=_BLANK>"; echo subquot(stripslashes($RSSData[$i][$month][$year][$j]['title'])); echo "</a>"; echo "</td></tr></table>"; echo "</td></tr>"; } echo "</table>"; // overlib line echo "',FGCOLOR,'{$overlibbgclr}',TEXTSIZE,'1',WIDTH,'125',VAUTO,HAUTO,STICKY,CAPTION,'"; echo $i . " " . $askedmonth . " ');\" onmouseout=\"return nd();\">"; echo "[" . $rsschannel . "]"; echo "</a>"; echo "</b></div>\n"; echo "</td></tr></table>"; } } // now get eventual events on $i $query = "select id,user,title,starttime,endtime from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where day='{$i}' and month='{$month}' and year='{$year}' and approved='1' "; if ($catview != 0) { $query = $query . " and " . $EVENTS_TB . ".cat={$catview} "; } if ($userview == 1 && $userlogin == 1) { // user view user specific events only if ($ugroup != 0) { $query = $query . " and " . $EVENTS_TB . ".user='******' "; } } $query = $query . " order by day,month,year,starttime,title ASC"; $result = mysql_query($query); $devtcnt = mysql_num_rows($result); if ($limitmthevt != 0 && $devtcnt != 0 && $devtcnt >= $limitmthevt) { echo "\n<div class=smallcalev><b> ## "; // overlib line echo "<a href='cal_day.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) . "&catview={$catview}' onmouseover=\"return overlib('"; echo "<table border=0 cellspacing=0 cellpadding=0 width=100%>"; while ($row = mysql_fetch_object($result)) { echo "<tr><td align=center valign=top>"; echo "<table class=eventborder border=1 cellspacing=0 cellpadding=0 width=100%><tr>"; if ($notimeentry == 0) { echo "<td align=center class=eventtimeborder valign=top>"; echo "<div class=smallcalevtime>"; if ($row->starttime == '') { echo " "; } else { showtime($row->starttime, $row->endtime, 1); } echo "</div>"; echo "</td>"; } echo "<td align=left valign=top width=80% class=eventborder>"; echo "<div class=smallcalev>"; // bug in overlib when putting hyperlink if ($popupevent == 1) { echo "<a class=smallcalev href=\\'Javascript:void(0);\\' onclick=\\'Javascript:popup(" . $row->id . ");\\'>"; } else { echo "<a class=smallcalev href=\\'cal_event.php?id=" . $row->id . "\\' >"; } echo subquot(stripslashes($row->title)); echo "</a>"; echo "</div>"; echo "</td></tr>"; echo "</table>"; echo "</td></tr>"; } echo "</table>"; // overlib line echo "',FGCOLOR,'{$overlibbgclr}',TEXTSIZE,'1',WIDTH,'125',VAUTO,HAUTO,STICKY,CAPTION,'"; echo $i . " " . $askedmonth . " ');\" onmouseout=\"return nd();\">"; echo $devtcnt . " " . translate("events"); echo "</a>"; echo " ## </b></div>\n"; } else { if ($devtcnt != 0) { echo "\n<table border=0 cellspacing=0 cellpadding=0 width='100%'>"; while ($row = mysql_fetch_object($result)) { echo "<tr><td align=center valign=top>\n"; echo "<table class=eventborder border=1 cellspacing=0 cellpadding=0 width='100%'><tr>"; if ($notimeentry == 0) { echo "<td align=center class=eventtimeborder valign=top>"; echo "<div class=smallcalevtime>"; if ($row->starttime == '') { echo " "; } else { showtime($row->starttime, $row->endtime, 1); } echo "</td>"; } echo "<td align=left valign=top width='80%' class=eventborder>"; if ($showuserentry == 1 && $uname != "") { echo "<" . $row->user . "> "; } if ($popupevent == 1) { echo "<a class=smallcalev href=\"Javascript:void(0);\" onclick=\"Javascript:popup(" . $row->id . ");\">"; } else { echo "<a class=smallcalev href=cal_event.php?id=" . $row->id . ">"; } echo stripslashes($row->title) . "</a>"; echo "</td></tr>"; echo "</table>"; } echo "</table>\n"; } } echo "</td>"; $a++; if (blankdays(intval($weekstartday), date("w", mktime(0, 0, 0, $month, $i, $year))) == 6) { echo "</tr>\n\n<tr>"; $a = 0; } } // ending stuff (making 'white' td's to fill table if ($a != 0) { $last = 7 - $a; for ($i = 1; $i <= $last; $i++) { echo "<td class=weekdayemptyclr> </td>"; } } echo "</tr>"; echo "</table>"; echo "<table width='100%' align=center border=0 cellspacing=1 cellpadding=0>"; echo "<tr><td align=center width='30%' valign=top>"; echo "<table class=txtbox width=70 align=left cellpadding=2 cellspacing=0><tr><td align=center class=todayclr><i><div class=normalfont>" . translate("Today") . "</div></i></td></tr></table>\n</td>"; echo "<td align=right valign=top width='30%'>"; echo "<form action=POST><div class=menufont>\n"; echo "<b>" . translate("Go to") . ": </b>"; // get months echo "<select name=gomonth onchange=\"javascript:gotomonth(this);\">\n"; for ($i = 1; $i < 13; $i++) { echo "\t<option value=" . $i; if ($month == $i) { echo " selected "; } echo ">" . ucfirst($mth[$i]) . "\n"; } echo "</select> \n"; // get year from "calstartyear" and give "caladvanceyear" years more to select echo "<select name=goyear onchange=\"javascript:gotoyear(this);\">\n"; for ($i = $calstartyear; $i <= $y + $caladvanceyear; $i++) { echo "\t<option value={$i}"; if ($year == $i) { echo " selected "; } echo ">{$i}\n"; } echo "</select><br/>\n"; echo "</div></form>"; echo "</td>"; // display search echo "<td align=right valign=bottom width='40%'>"; if ($allowsearch == 1 && $searchmonthok == 1) { search(); } else { echo " "; } echo "</td></tr>"; echo "</table>"; } else { echo "<br/><div class=titlefont>" . translate("disabled") . ".</div>"; } }
function evlist($date, $catcolor, $secondcatcolor, $sort) { global $EVENTS_TB, $CAT_TB, $USER_TB, $mth, $week, $m, $d, $y, $searchweekok, $popupevent, $popupeventwidth, $popupeventheight, $weekstartday, $calstartyear, $caladvanceyear, $allowsearch, $addeventok, $userid, $userview, $userlogin, $shortdesclen, $catview, $uname, $ugroup, $showuserentry, $publicview, $dayview_w, $notimeentry, $viewevlistok, $limitrow, $eventcatfilter; if ($viewevlistok == 1) { if (!$date) { $year = $y; $month = $m; $day = $d; } else { $year = substr($date, 0, 4); $month = substr($date, 5, 2); $day = substr($date, 8, 2); } if (!isset($_GET['catmonth'])) { $catmonth = ''; } else { $catmonth = $_GET['catmonth']; } if (!isset($_GET['limit'])) { $limit = 0; } else { $limit = $_GET['limit']; } $qstr = " id,description,title,cat,day,month,year,starttime,endtime,cat_name "; $query = " from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where approved='1' "; $query .= " and ((year>'{$y}')||(month>'{$m}' and year='{$y}')||(day>={$d} and month='{$m}' and year='{$y}'))"; if ($userview == 1 && $userlogin == 1 && $uname != "") { if ($ugroup != 0) { // Generate the query $qstr = " {$EVENTS_TB}.id, {$EVENTS_TB}.description, {$EVENTS_TB}.title, {$EVENTS_TB}.cat, {$EVENTS_TB}.starttime, {$EVENTS_TB}.endtime, {$EVENTS_TB}.user, {$EVENTS_TB}.day, {$EVENTS_TB}.month, {$EVENTS_TB}.year, {$CAT_TB}.cat_name, {$USER_TB}.username, {$USER_TB}.user_id "; $query = " from " . $EVENTS_TB . ", " . $USER_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where approved='1' "; $query .= " and ((year>'{$y}')||(month>'{$m}' and year='{$y}')||(day>={$d} and month='{$m}' and year='{$y}'))"; $query .= " and " . $EVENTS_TB . ".user="******".username and " . $USER_TB . ".user_id=" . $userid; } } if ($eventcatfilter == 1 && $catview != 0) { $query .= " and cat_id={$catview}"; } if ($sort && $sort == 1) { $query = $query . " order by title ASC, year ASC, month ASC, day ASC"; } else { $query = $query . " order by year ASC, month ASC, day ASC, title ASC"; } $tquery = "select count(*) " . $query; $tresult = mysql_query($tquery); $trow = mysql_fetch_array($tresult); $totalrows = $trow[0]; if ($limit > $totalrows) { $limit = 0; } $query .= " LIMIT " . $limit . "," . $limitrow; $query = "select " . $qstr . $query; $result = mysql_query($query); $rowname = mysql_fetch_object($result); $rows = mysql_num_rows($result); // this is for the category sort order redirection javascript echo "<script language=\"JavaScript\" type=\"text/JavaScript\">\n"; echo "\tfunction sortev(order) {\n"; echo "\t\tswitch (order) { \n"; echo "case 1 : { window.location.href='cal_list.php?op=evlist&sort=1&catview={$catview}&limit={$limit}' ; break ;} \n"; echo "case 2 : { window.location.href='cal_list.php?op=evlist&sort=2&catview={$catview}&limit={$limit}' ; break ;} \n"; echo "default : { window.location.href='cal_list.php?op=evlist&sort=2&catview={$catview}&limit={$limit}' ; break;} \n"; echo "\t\t}\n"; echo "\t}\n"; echo "</script>"; echo "<form action=POST>\n"; echo "<table class=titlefont width={$dayview_w} border=0 cellspacing=0><tr><td align=left valign=top width='40%'>"; echo "<div class=titlefont>" . translate("Events from ") . $d . " " . ucfirst($mth[$m]) . " " . $y . "</div>"; echo "</td><td valign=top width='30%' align=left>"; // previous and next row set echo "<div class=menufont><input type='button' value=' < ' title='" . translate("Previous") . "' onclick=\"Javascript:window.location.href='cal_list.php?op=evlist&sort={$sort}&catview={$catview}&limit=" . ($limit - $limitrow) . "' ;\" "; if ($limit == 0) { echo " disabled "; } echo "> \n"; echo "<b> " . ($limit + 1) . " - "; if ($limit + $limitrow < $totalrows) { echo $limit + $limitrow; } else { echo $totalrows; } echo "/" . $totalrows; echo " " . translate("events") . " "; echo "</b> \n"; echo "<input type='button' value=' > ' title='" . translate('Next') . "' onclick=\"Javascript:window.location.href='cal_list.php?op=evlist&sort={$sort}&catview={$catview}&limit=" . ($limit + $limitrow) . "' ;\" "; if ($limit + $limitrow >= $totalrows) { echo " disabled "; } echo "></div>\n"; echo "</td><td align=right valign=top width='30%'><div class=menufont><b>" . translate("Sort by") . ": </b>"; echo " <a href='#' onclick=\"Javascript:sortev(1);\"><img src='images/sort1.gif' border=0 alt='" . translate("Sort by events") . "'/></a>"; echo " <a href='#' onclick=\"Javascript:sortev(2);\"><img src='images/sort2.gif' border=0 alt='" . translate("Sort by date") . "'/></a>"; echo " </div></td></tr></table>\n"; if (!$rows) { echo "<br/><div class=titlefont>" . translate("No events") . ".</div><br/>\n"; } else { $result = mysql_query($query); $foo = ''; while ($row = mysql_fetch_object($result)) { $foo++ % 2 ? $color = $catcolor : ($color = $secondcatcolor); echo "<table class=normalfont border=0 bgcolor={$color} cellspacing=0 cellpadding=4 width={$dayview_w}>\n"; echo "<tr><td>"; echo "<div class=searchtitlefont><li>"; $weekday = date("w", mktime(12, 0, 0, $row->month, $row->day, $row->year)); echo stripslashes($row->title) . " (" . ucfirst($week[++$weekday]) . ", " . $row->day . " " . $mth[$row->month] . " " . $row->year . ")</li></div>"; echo "<div class=searchtextfont>"; echo "<b>" . translate("Category") . " : </b>" . stripslashes($row->cat_name); if ($notimeentry == 0) { showtime($row->starttime, $row->endtime, 2); } echo "</div>"; $de = $row->description; echo "<div class=searchtextfont>" . substr(stripslashes($de), 0, $shortdesclen) . " ...</div>\n"; if ($popupevent == 1) { echo "<div class=menufont><a href=\"Javascript:void(0);\" onclick=\"Javascript:popup(" . $row->id . ");\">"; } else { echo "<div class=menufont><a href='cal_event.php?id=" . $row->id . "' >"; } echo translate("Read more") . "</a></div>"; echo "</td></tr>\n"; echo "</table>\n"; } } echo "</form>\n"; // display form functions echo "<table border=0 width={$dayview_w}><tr>"; echo "<td align=left valign=top width='50%'>\n"; echo " </td>"; echo "<td align=right valign=middle width='50%'>"; if ($allowsearch == 1) { search(); } echo "</td></tr></table>"; } else { echo "<br/><div class=titlefont>" . translate("disabled") . ".</div>"; } }
public function index() { // dynamically generate the quick links from the permissions for the selected module $eglet = new SimpleMenuEGlet(new SimpleRenderer()); $eglet->setMenuData($this->dashboard_module, $system->pid); $eglet->setSmarty($this->view); if (count($eglet->getContents()) > 0) { $this->view->set('eglets', array('Quick Links' => $eglet)); } #$cache = Cache::Instance(); #$eglet_store = $cache->get(array('eglet_store', $this->module)); // ATTN: we're avoiding the cache because eglets are appearing (and not appearing) // where they should be. it seems the module grouping isn't actually working $eglet_store = FALSE; $ao =& AccessObject::Instance(EGS_USERNAME); if (FALSE === $eglet_store) { // get user's uzlet preferences $prefs = UserPreferences::Instance(EGS_USERNAME); $user_uzlets = $prefs->getPreferenceValue('dashboard_contents', $this->dashboard_module); $user_uzlets = is_array($user_uzlets) ? array_flip($user_uzlets) : array(); // discover what uzlet_id's belong to the module we're working with $uzlets = new UzletCollection(); $sh = new SearchHandler($uzlets, FALSE); if (count($user_uzlets) > 0) { // get the uzlet details for the user's uzlet preferences $db = DB::Instance(); $uzlet_names = array(); foreach ($user_uzlets as $name => $value) { $uzlet_names[] = $db->qstr($name); } $sh->addConstraint(new Constraint('name', 'in', '(' . implode(',', $uzlet_names) . ')')); } else { // user preferences are not set, get the default(preset) uzlets for the module $sh->addConstraint(new Constraint('preset', 'is', TRUE)); if ($this->dashboard_module == 'dashboard') { $sh->addConstraint(new Constraint('dashboard', 'is', TRUE)); // only include uzlets for modules the user has access to foreach ($ao->permissions as $permission) { if ($permission['type'] == 'm' && !empty($permission['module_id'])) { $modules[$permission['module_id']] = $permission['module_id']; } } if (count($modules) > 0) { $sh->addConstraint(new Constraint('module_id', 'in', '(' . implode(',', $modules) . ')')); } else { $sh->addConstraint(new Constraint('module_id', '=', -1)); } } else { $sh->addConstraint(new Constraint('module', '=', $this->dashboard_module)); } } $sh->addConstraint(new Constraint('enabled', 'is', TRUE)); $rows = $uzlets->load($sh, null, RETURN_ROWS); $uzlets = array(); if (!empty($rows)) { if (empty($user_uzlets)) { // no user uzlet preferences so set uzlets to the default(preset) for the module foreach ($rows as $uzlet) { $uzlets[$uzlet['name']] = $uzlet; } } else { // Preserve order of user's uzlet preferences foreach ($rows as $uzlet) { if (isset($user_uzlets[$uzlet['name']])) { $user_uzlets[$uzlet['name']] = $uzlet; } } // Remove any user's uzlet preferences that are no longer valid foreach ($user_uzlets as $name => $uzlet) { if (!is_array($uzlet)) { unset($user_uzlets[$name]); } } $uzlets = $user_uzlets; } } $this->view->set('uzlets', $uzlets); } showtime('pre-pop'); $this->view->set('can_edit', $ao->can_manage_uzlets()); }
echo ' <div class="post-list"> <div class="item-avatar"><a href="/user/', $article['uid'], '">'; if (!$is_spider) { echo '<img src="/avatar/large/', $article['uavatar'], '.png" alt="', $article['author'], '" />'; } else { echo '<img src="/static/grey.gif" data-original="/avatar/large/', $article['uavatar'], '.png" alt="', $article['author'], '" />'; } echo ' </a></div> <div class="item-content"> <h1><a href="/topics/', $article['id'], '">', $article['title'], '</a></h1> <span class="item-date"><i class="fa fa-archive"></i> <a href="/nodes/', $article['cid'], '">', $article['cname'], '</a> <i class="fa fa-user"></i> <a href="/user/', $article['uid'], '">', $article['author'], '</a>'; if ($article['comments']) { echo ' <i class="fa fa-clock-o"></i> ', showtime($article['edittime']), ' <i class="fa fa-user-secret"></i> 最后回复来自 <a href="/user/', $article['ruid'], '">', $article['rauthor'], '</a>'; } else { echo ' <i class="fa fa-clock-o"></i> ', showtime($article['addtime']); } echo ' </span> </div>'; if ($article['comments']) { $gotopage = ceil($article['comments'] / $options['commentlist_num']); if ($gotopage == 1) { $c_page = ''; } else { $c_page = '/' . $gotopage; } echo '<div class="item-count"><a href="/topics/', $article['id'], $c_page, '#reply', $article['comments'], '">', $article['comments'], '</a></div>'; } echo ' <div class="c"></div> </div>'; }
public function index(DataObjectCollection $collection, $sh = '', &$c_query = null) { showtime('start-controller-index'); $collection->setParams(); if (!$sh instanceof SearchHandler) { $sh = $this->setSearchHandler($collection); } showtime('sh-extracted'); if (isset($this->search) && !isset($this->_data['orderby']) && !isset($this->_data['page'])) { $cc = $this->search->toConstraintChain(); $sh->addConstraintChain($cc); $sh->save(); // cache the search string $search_string_array = array('fop' => $this->search->toString('fop'), 'html' => $this->search->toString('html')); $_SESSION['search_strings'][EGS_USERNAME][$sh->search_id] = $search_string_array; } // Need to set the orderby of the collection in the searchhandler? // But if this is set in the collection, seems to take it // so why not here? showtime('pre-load'); $collection->load($sh, $c_query); $this->view->set('total_records', $collection->total_records); $this->view->set('num_records', $collection->num_records); $this->view->set('num_pages', $collection->num_pages); $this->view->set('cur_page', $collection->cur_page); showtime('post-load'); $this->view->set(strtolower($collection->getModelName()) . 's', $collection); if (isset($this->_data['json'])) { $this->view->set('echo', $collection->toJSON()); } if ($this->_templateName === false) { $this->_templateName = $this->getTemplateName('index'); } showtime('end-controller-index'); }
public function index(DataObjectCollection $collection, $sh = '', &$c_query = null) { $display_fields = array(); $model = $collection->getModel(); // If selection of display fields is disabled, don't set them up if (!$this->search->disable_field_selection) { foreach ($model->getFields() as $fieldname => $field) { if ($fieldname != 'id' && $fieldname != 'usercompanyid' && substr($fieldname, -3) != '_id' && !isset($model->belongsToField[$fieldname])) { $display_fields[$fieldname] = $field->tag; } } $selected_fields = array(); if (isset($this->_data['Search']['display_fields'])) { foreach ($this->_data['Search']['display_fields'] as $fieldname => $field) { $selected_fields[$fieldname] = prettify($field); } } else { foreach ($collection->getFields() as $fieldname => $field) { if (substr($fieldname, -3) != '_id') { $selected_fields[$fieldname] = $field->tag; } } } $this->view->set('selected_fields', $selected_fields); $display_fields = array_diff($display_fields, $selected_fields); $this->view->set('display_fields', $display_fields); } if (!isset($this->_data['ajax_print'])) { parent::index($collection, $sh, $c_query); return; } showtime('start-controller-index'); $collection->setParams(); if (!$sh instanceof SearchHandler) { $sh = $this->setSearchHandler($collection); } showtime('sh-extracted'); // Need to set the orderby of the collection in the searchhandler? // But if this is set in the collection, seems to take it // so why not here? showtime('pre-load'); // TODO: Printing needs looking at; the model is too complicated and // therefore maintenance is difficult. Needs breaking down into more // logical discrete units. // BEWARE: the following may not work for all cases // needs extensive testing; this is implemented for selectorController output if ($this->_data['session_key'] == 'undefined') { $sh->setLimit(0); $collection->load($sh); $this->PrintCollection($collection); } // echo 'controller::index setting printing session data<br>'; // in this instance we can only pass the data through the session // but it's only the collection name and search id :-) $_SESSION['printing'][$this->_data['session_key']]['collection'] = get_class($collection); $_SESSION['printing'][$this->_data['session_key']]['search_id'] = $this->_data['search_id']; exit; showtime('end-controller-index'); }
function smallmonth($smmonth, $smyear, $showyear, $ud, $um, $uy, $showeventcount) { global $EVENTS_TB, $USER_TB, $CAT_TB, $mth, $week, $todayclr, $viewcalok, $userid, $userview, $userlogin, $uname, $ugroup, $weekstartday, $overlibbgclr, $catview, $notimeentry; // number of days in month $firstday = date("w", mktime(12, 0, 0, $smmonth, 1, $smyear)); $nr = date("t", mktime(12, 0, 0, $smmonth, 1, $smyear)); echo "\n\n<table class='smallcalmth' align='center'>"; echo "<tr>"; echo "<td align='center' width='98%'><div class='smallcalmth'>"; if ($viewcalok == 1) { echo "<a class='smallcalmth' href=\"#\" onclick='Javascript:top.opener.window.location = \"calendar.php?op=cal&month=" . $smmonth . "&year=" . $smyear . "\";'>"; } echo $mth[$smmonth]; if ($viewcalok == 1) { echo "</a> "; } if ($showyear) { echo $smyear; } echo "</div></td></tr></table>\n\n"; echo "<table align='center' class='smallcalmth'>"; echo "<tr>"; // make the header days of week for ($i = intval($weekstartday) + 1; $i <= intval($weekstartday) + 7; $i++) { echo "<td align='center' width='14%'>"; if (dayinweek($i) == 1) { echo "<div class='dayfont'>" . substr($week[dayinweek($i)], 0, 3) . "</div></td>"; } else { echo "<div class='dayfont'>" . substr($week[dayinweek($i)], 0, 3) . "</div></td>"; } // rest of week } echo "</tr>\n\n<tr>"; // print initial blank squares for ($i = 1; $i <= blankdays(intval($weekstartday), $firstday); $i++) { echo "<td> </td>"; } $a = 0; for ($i = 1; $i <= $nr; $i++) { // now get eventual events on $i $query = "select id,user,title,starttime,endtime from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where day='{$i}' and month='{$smmonth}' and year='{$smyear}' and approved='1' "; if ($catview != 0) { $query = $query . " and " . $EVENTS_TB . ".cat={$catview} "; } if ($userview == 1 && $userlogin == 1) { // user view user specific events only if ($ugroup != 0) { $query = $query . " and " . $EVENTS_TB . ".user='******' "; } } $query = $query . " order by day,month,year,starttime,title ASC"; $result = mysql_query($query); $devtcnt = mysql_num_rows($result); echo "<td align='center' "; if ($i == $ud && $smmonth == $um && $smyear == $uy) { // highlight today's day echo "class='todayclr' "; } elseif ($devtcnt != 0) { echo "class='smallcalmth' "; } echo "valign='top'>\n"; if ($devtcnt != 0) { // overlib line echo "<a href=\"javascript:void(0);\" onmouseover=\"return overlib('"; echo "<table border=0 cellspacing=0 cellpadding=0>"; while ($row = mysql_fetch_object($result)) { echo "<tr><td align=center valign=top>"; echo "<table class=eventborder cellspacing=0 cellpadding=0><tr>"; if ($notimeentry == 0) { echo "<td align=center class=eventtimeborder valign=top>"; echo "<div class=smallcalevtime>"; if ($row->starttime == '') { echo " "; } else { showtime($row->starttime, $row->endtime, 1); } echo "</div>"; echo "</td>"; } echo "<td align=left valign=top width=80% class=eventborder>"; echo "<div class=smallcalev>"; echo subquot(stripslashes($row->title)); echo "</div>"; echo "</td></tr>"; echo "</table>"; } echo "</td></tr>"; echo "</table>"; // overlib line echo "',FGCOLOR,'{$overlibbgclr}',TEXTSIZE,'1',WIDTH,'120',VAUTO,HAUTO);\" onmouseout=\"return nd();\">"; } echo "<div class='datenumfont'>" . $i . "</div>"; if ($devtcnt != 0) { echo "</a>"; } echo "</td>\n"; $a++; if (blankdays(intval($weekstartday), date("w", mktime(0, 0, 0, $smmonth, $i, $smyear))) == 6) { echo "</tr>\n\n"; if ($a != 0 && $i != $nr) { echo "<tr>"; } $a = 0; } } if ($a != 0) { for ($i = $a; $i < 7; $i++) { echo "<td> </td>"; } echo "</tr>"; } if ($showeventcount) { echo "<tr><td align='center' valign='top' colspan='7'>"; // get total number of events for month $tquery = "select id from " . $EVENTS_TB . " where " . $EVENTS_TB . ".month='" . $smmonth . "' and " . $EVENTS_TB . ".year='" . $smyear . "' and " . $EVENTS_TB . ".approved='1' "; $normuser = false; if ($userview == 1 && $userlogin == 1 && $uname != "") { // view user specific events only $uquery = "select group_id from " . $USER_TB . " where " . $USER_TB . ".user_id=" . $userid; $uresult = mysql_query($uquery); $urow = mysql_fetch_object($uresult); if ($urow->group_id != 0) { $normuser = true; $tquery = "select * from " . $EVENTS_TB . "," . $USER_TB . " where " . $EVENTS_TB . ".month='" . $smmonth . "' and " . $EVENTS_TB . ".year='" . $smyear . "' and " . $EVENTS_TB . ".approved='1' and " . $EVENTS_TB . ".user="******".username and " . $USER_TB . ".user_id=" . $userid; } } $tresult = mysql_query($tquery); $trows = mysql_num_rows($tresult); echo "<table class='txtbox' cellspacing='0' cellpadding='0'><tr><td align='center'><div class='normalfont'> " . $trows . " " . translate("events") . " </div></td></tr></table>"; echo "</td></tr>"; } echo "</table>"; }
</div> <div class="main-box home-box-list">'; foreach ($articledb as $article) { echo ' <div class="post-list"> <div class="item-avatar"><a href="/user/', $article['uid'], '"> <img src="/avatar/normal/', $article['uavatar'], '.png" alt="', $article['author'], '" /> </a></div> <div class="item-content count', $article['comments'], '"> <h1><a rel="bookmark" href="/topics/', $article['id'], '">', $article['title'], '</a></h1> <span class="item-date"><i class="fa fa-archive"></i> <a href="/nodes/', $article['cid'], '">', $article['cname'], '</a>'; if ($article['comments']) { echo ' <i class="fa fa-user"></i> <a href="/user/', $article['ruid'], '">', $article['rauthor'], '</a> <i class="fa fa-clock-o"></i> <time datetime="', showtime2($article['edittime']), '" pubdate="pubdate" data-updated="true">', showtime($article['edittime']), '</time>回复'; } else { echo ' <i class="fa fa-user"></i> <a href="/user/', $article['uid'], '">', $article['author'], '</a> <i class="fa fa-clock-o"></i> <time datetime="', showtime2($article['addtime']), '" pubdate="pubdate" data-updated="true">', showtime($article['addtime']), '</time>发表'; } echo ' </span> </div>'; if ($article['comments']) { $gotopage = ceil($article['comments'] / $options['commentlist_num']); if ($gotopage == 1) { $c_page = ''; } else { $c_page = '/' . $gotopage; } echo '<div class="item-count"><a href="/topics/', $article['id'], $c_page, '#reply', $article['comments'], '">', $article['comments'], '</a></div>'; } echo ' <div class="c"></div> </div>'; }
echo ' <div class="nav-title"> <i class="fa fa-angle-double-right"></i> <a href="/nodes/', $c_obj['id'], '">', $c_obj['name'], '</a> (', $c_obj['articles'], ')'; if ($cur_user['notic']) { $notic_n = count(array_unique(explode(',', $cur_user['notic']))) - 1; echo '<span class="nopic"><a href="/notifications"><i class="fa fa-bell"></i> 您有', $notic_n, '条消息</a></span>'; } echo ' <div class="c"></div> </div> <div class="main-box"> <div class="topic-title"> <div class="topic-title-main float-left"> <h1>', $t_obj['title'], '</h1> <div class="topic-title-date"> <i class="fa fa-clock-o"></i><time datetime="', showtime2($t_obj['edittime']), '" pubdate="pubdate" data-updated="true">', showtime($t_obj['addtime']), '</time> <i class="fa fa-eye"></i>', $t_obj['views'], '阅读'; if ($t_obj['favorites']) { echo ' <i class="fa fa-star"></i>', $t_obj['favorites'], '收藏'; } if ($cur_user && $cur_user['flag'] > 4) { if ($in_favorites) { echo ' <i class="fa fa-star-o"></i><a href="/favorites?act=del&id=', $t_obj['id'], '" title="取消收藏">取消</a>'; } else { echo ' <i class="fa fa-star"></i><a href="/favorites?act=add&id=', $t_obj['id'], '" title="收藏">收藏</a>'; } if ($cur_user['flag'] >= 99) { echo ' <i class="fa fa-pencil-square"></i><a href="/admin-edit-post-', $t_obj['id'], '">编辑</a>'; } } echo ' </div> </div>
function day($ask, $date) { global $EVENTS_TB, $CAT_TB, $USER_TB, $uname, $mth, $week, $language, $m, $d, $y, $calstartyear, $caladvanceyear, $unapprovedclr, $shortdesclen, $showuserentry, $notimeentry; // View events for specific user if (!isset($_POST['huser'])) { $huser = ''; } else { $huser = $_POST['huser']; } if (!isset($yda)) { $yda = ''; } if (!$date) { $year = $y; $month = $m; $day = $d; } else { $year = substr($date, 0, 4); $month = substr($date, 5, 2); $day = substr($date, 8, 2); } $we = mktime(0, 0, 0, $month, $day, $year); $we = strftime("%w", $we); $we++; // variables with exact digit without the leading 0 used for query and accessing array $vdm = $month; if (substr($vdm, 0, 1) == "0") { $vdm = str_replace("0", "", $vdm); } $vda = $day; if (substr($vda, 0, 1) == "0") { $vda = str_replace("0", "", $vda); } $weeknumber = weekNumber($day, $month, $year); if ($year > $y + $caladvanceyear) { $weeknumber = 53; } // to ensure weeks cannot go beyond restricted dates if ($year < $calstartyear) { $weeknumber = 1; } // to ensure weeks cannot go beyond restricted dates echo "<table class=headerfont border=0 width=100% cellspacing=0><tr><td align=left>" . translate("Events for day"); echo ": " . $week[$we] . " " . $day; if ($year <= $y + $caladvanceyear && $year >= $calstartyear) { echo " <a class=headerfont href=calendar.php?op=cal&month=" . $vdm . "&year=" . $year; urlvar($uname); echo " >"; } else { echo " "; } echo $mth[$vdm]; if ($year <= $y + $caladvanceyear && $year >= $calstartyear) { echo "</a> "; } else { echo " "; } echo $year . " <a href=cal_adminweek.php?op=week&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); urlvar($uname); echo " ><img src=\"../images/week.gif\" border=0 alt='" . translate("View week") . " {$weeknumber}" . "' width=16 height=16/></a>"; echo " <a href='cal_event.php?op=eventform&add_day={$day}&add_month={$month}&add_year={$year}'><img src='../images/plus.gif' border=0 valign=middle alt='" . translate("Add Event") . "' width=11 height=11/></a>"; echo "</td>"; echo "<td align=right><div class=menufont>"; // display previous day and next day navigation if ($year > $calstartyear || $vdm > 1 && $year == $calstartyear || $vdm == 1 && $year == $calstartyear && $vda > 1) { echo "<a href=\"cal_adminday.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day - 1, $year)); urlvar($uname); echo "\"><< " . translate("Previous day") . "</a> "; } else { echo " "; } $calendyear = $y + $caladvanceyear; if ($year < $calendyear || $vdm < 12 && $year == $calendyear || $vdm == 12 && $year == $calendyear && $vda < 31) { echo "<a href=\"cal_adminday.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day + 1, $year)); urlvar($uname); echo "\">" . translate("Next day") . " >></a> <br/>"; } else { echo " "; } echo "</div></td></tr></table>"; $query = "select id,user,title,description,url,email,cat_name,starttime,endtime,day,month,year,approved from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where day='{$vda}' and month='{$vdm}' and year='{$year}' "; if ($uname != "" && $uname != "-") { $query = $query . " and " . $EVENTS_TB . ".user='******' "; } $query = $query . " order by starttime,title ASC"; $result = mysql_query($query); echo "<table class=dayevent width=100% border=0 class=dayevent cellspacing=0><tr><td align=left>"; if (mysql_num_rows($result) != 0) { while ($row = mysql_fetch_object($result)) { if ($row->approved == '0') { echo "<table class=dayevent width=100% border=0 ><tr><td bgcolor='{$unapprovedclr}'>"; } if ($notimeentry == 0) { if ($row->starttime == '') { echo "<li>"; } else { showtime($row->starttime, $row->endtime, 0); } } else { echo "<li>"; } echo "<b>" . stripslashes($row->title); if ($showuserentry == 1) { echo " <" . $row->user . ">"; } echo "</b>"; if ($notimeentry == 1 || $row->starttime == '') { echo "</li>"; } else { echo "<br/>"; } echo translate("Category") . " : " . stripslashes($row->cat_name) . "<br/>"; $de = $row->description; //$de = str_replace("<br />","",$row->description); echo substr(stripslashes($de), 0, $shortdesclen); if ($row->email != "" || $row->url != "" || strlen($de) > $shortdesclen) { echo " ...\n"; } else { echo "\n"; } echo "<div class=menufont><a href=cal_event.php?op=view&id=" . $row->id . ">" . translate("View event") . "</a>\n"; echo " - <a href=cal_event.php?op=edit&id=" . $row->id . ">" . translate("Edit event") . "</a>\n"; echo " - <a href=cal_event.php?op=delev&id=" . $row->id . ">" . translate("Delete event") . "</a>\n"; if ($row->approved == '0') { echo " - <a href=calendar.php?op=approve&id=" . $row->id . ">" . translate("Approve") . "</a>\n"; } echo "</div>\n"; echo "<hr/>"; if ($row->approved == '0') { echo "</td></tr></table>"; } } } else { echo " <br/>"; } echo "</td></tr></table>"; // this is for the goto day redirection javascript echo "<script language=\"JavaScript\" type=\"text/JavaScript\">\n"; echo "\tfunction gotoday(selectopt) {\n"; echo "var geti = '1' ;\n"; echo "for (i=0;i<selectopt.options.length;i++) {\n"; echo "\tif (selectopt.options[i].selected) {\n"; echo "\t\tgeti = selectopt.options[i].value ;\n"; echo "\t\tbreak ;\n"; echo "\t}\n"; echo "}\n\n"; echo "\t\tswitch (geti) { \n"; $dateinmonth = date("t", mktime(0, 0, 0, $month, $day, $year)); for ($i = 1; $i <= $dateinmonth; ++$i) { $jstr = "cal_adminday.php?op=day&date="; $jstr = $jstr . date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)); if ($uname != "" && $uname != "-") { $jstr = $jstr . "&uname={$uname}"; } echo "case \"" . $i . "\" : { window.location.href='" . $jstr . "' ; break ;} \n"; } echo "default : { window.location.href='cal_adminday.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)) . "' ; break;} \n"; echo "\t\t}\n"; echo "\t}\n"; echo "</script>"; // display form functions echo "<table border=0 width=100%><tr><td align=left width=50%>"; echo "<table width=100 cellspacing=0 cellpadding=2 align=left class=txtbox><tr><td bgcolor='{$unapprovedclr}' align=center><div class=normalfont>" . translate("Unapproved events") . "</div></td></tr></table>\n</td>"; echo "<td align=right valign=middle width=50%>"; echo "<form><div class=menufont>\n"; echo "<b>" . translate("Go to day") . " </b>"; // get week number echo "<select name=goday onchange=\"javascript:gotoday(this);\""; if ($year > $y + $caladvanceyear || $year < $calstartyear) { echo " disabled"; } echo ">\n"; for ($i = 1; $i <= $dateinmonth; $i++) { echo "\t<option value=" . $i; if ($day == $i) { echo " selected "; } echo ">" . $i . "\n"; } echo "</select>\n"; echo "<b>" . translate("or week") . " </b>"; // get week number echo "<select name=goweek onchange=\"javascript:gotoweek(this);\">\n"; for ($i = 1; $i < 53; $i++) { echo "\t<option value=" . $i; if ($weeknumber == $i) { echo " selected "; } echo ">" . $i . "\n"; } if (showWeek53($year) > 52) { for ($i = 53; $i <= showWeek53($year); $i++) { echo "\t<option value=" . $i; if ($weeknumber == $i) { echo " selected "; } echo ">" . $i . "\n"; } } echo "</select> <br/>\n"; // Display the users to be selected echo "<b>" . translate("View events of user") . ": </b> "; // get users $uquery = "select username,user_id from " . $USER_TB; $uresult = mysql_query($uquery); echo "<select name=huser onchange=\"Javascript:seeuser(this);\">\n"; echo "\t<option value='-'"; if ($uname == "-" || $uname == "") { echo " selected "; } echo ">--\n"; while ($urow = mysql_fetch_object($uresult)) { echo "\t<option value='{$urow->username}'"; if ($uname == "{$urow->username}") { echo " selected "; } echo ">" . $urow->username . "\n"; } echo "</select> \n"; echo "</div></form>"; echo "</td>"; echo "<td align=right valign=middle width=33%>"; echo "</td></tr></table>"; }
} if (!empty($_POST['ip'])) { $querystr .= " AND ip='%s'"; array_push($argv, $_POST['ip']); } $querystr .= " ORDER BY date,id LIMIT " . $next . "," . ($next + $limit + 1); array_unshift($argv, $querystr); $query = squery_args($argv); $i = 0; while ($result = sql_fetch_array($query)) { $i++; if ($i > $limit) { echo "<tr><td colspan=\"4\" align=\"center\">*** There are more results... ***</td></tr>"; break; } $sdate = showtime($result['date']); if (isodd($i)) { $class = ""; } else { $class = "alt"; } ?> <tr> <td class=<?php echo $class; ?> ><?php echo $sdate; ?> </td> <td class=<?php
} else { if ($act == 'pass') { $tip1 = '数据库更新失败,修改尚未保存,请稍后再试'; } else { $tip2 = '数据库更新失败,修改尚未保存,请稍后再试'; } } } // users表flag 列没加入到索引,如果用户上10万,获取下面用户有点慢,8~10秒 // 获取最近等待审核的用户 $query_sql = "SELECT id,name,regtime FROM yunbbs_users WHERE flag=1 ORDER BY id DESC LIMIT 10"; $query = $DBS->query($query_sql); $userdb = array(); while ($user = $DBS->fetch_array($query)) { // 格式化内容 $user['regtime'] = showtime($user['regtime']); $userdb[] = $user; } // 获取最近被禁用的用户 $query_sql = "SELECT id,name,regtime FROM yunbbs_users WHERE flag=0 ORDER BY id DESC LIMIT 10"; $query = $DBS->query($query_sql); $userdb2 = array(); while ($user = $DBS->fetch_array($query)) { // 格式化内容 $user['regtime'] = showtime($user['regtime']); $userdb2[] = $user; } // 页面变量 $title = '用户管理'; $pagefile = CURRENT_DIR . '/templates/default/' . $tpl . 'admin-user.php'; include CURRENT_DIR . '/templates/default/' . $tpl . 'layout.php';
$table_msgCount = $DBS->fetch_one_array("SELECT count(1) as count FROM `yunbbs_messages` \n WHERE (FromUID={$cur_uid} and ToUID={$cid}) OR (FromUID = {$cid} and ToUID={$cur_uid})"); $total_msg = $table_msgCount['count']; // 处理正确的页数 // 第一页是1 $total_page = ceil($total_msg / $options['list_shownum']); if ($page <= 0 || $total_page == 0) { $page = 1; } elseif ($page > $total_page) { $page = $total_page; } $query_sql = "SELECT m.*,u1.avatar FROM `yunbbs_messages` m\n inner join yunbbs_users u1 on m.FromUID=u1.id\n WHERE (FromUID={$cur_uid} and ToUID={$cid}) OR (FromUID = {$cid} and ToUID={$cur_uid})\n order by id desc limit " . ($page - 1) * $options['list_shownum'] . "," . $options['list_shownum']; $query = $DBS->query($query_sql); $messagedb = array(); while ($message = $DBS->fetch_array($query)) { // 格式化内容 if ($message['IsRead'] == '0' && $message['ToUID'] == $cur_uid) { $message['Title'] = "<span class=\"label label-success\">未读</span>"; } else { $message['Title'] = ''; } $message['AddTime'] = showtime($message['AddTime']); $messagedb[] = $message; } unset($message); $DBS->free_result($query); // 设置此人发给我的消息为已读 $DBS->unbuffered_query("UPDATE yunbbs_messages SET IsRead=1 WHERE FromUID={$cid} and ToUID={$cur_uid}"); // 页面变量 $title = '发私信'; $pagefile = CURRENT_DIR . '/templates/default/' . $tpl . 'newmessage.php'; include CURRENT_DIR . '/templates/default/' . $tpl . 'layout.php';
</div> <div class="main-box home-box-list">'; foreach ($articledb as $article) { echo ' <div class="post-list"> <div class="item-avatar"><a href="/user/', $article['uid'], '"> <img src="/avatar/normal/', $article['uavatar'], '.png" alt="', $article['author'], '" /> </a></div> <div class="item-content count', $article['comments'], '"> <h1><a href="/topics/', $article['id'], '">', $article['title'], '</a></h1> <span class="item-date"><i class="fa fa-archive"></i> <a href="/nodes/', $article['cid'], '">', $article['cname'], '</a>'; if ($article['comments']) { echo ' <i class="fa fa-user"></i> <a href="/user/', $article['ruid'], '">', $article['rauthor'], '</a> <i class="fa fa-clock-o"></i> ', showtime($article['edittime']), '回复'; } else { echo ' <i class="fa fa-user"></i> <a href="/user/', $article['uid'], '">', $article['author'], '</a> <i class="fa fa-clock-o"></i> ', showtime($article['addtime']), '发表'; } echo ' </span> </div>'; if ($article['comments']) { $gotopage = ceil($article['comments'] / $options['commentlist_num']); if ($gotopage == 1) { $c_page = ''; } else { $c_page = '/' . $gotopage; } echo '<div class="item-count"><a href="/topics/', $article['id'], $c_page, '#reply', $article['comments'], '">', $article['comments'], '</a></div>'; } echo ' <div class="c"></div> </div>'; }
<?=show_board_body($description)?> </td></tr> </table> </td></tr> <? } else { ?> <tr><td colspan="2"> <table border="1" width="100%" cellpadding="0" cellspacing="0"> <tr class="Karnaf_Head2"><td colspan="2">Replies</td></tr> <? $query2 = squery("SELECT reply,r_time,r_from,r_by,ip FROM karnaf_replies WHERE tid=%d ORDER BY r_time", $id); $cnt = 0; while($result2 = sql_fetch_array($query2)) { $cnt++; $reply = preg_replace("/(\*)?\[image\:\sironSource\](\*)?.*Thank\syou\./s", "*** Signature ***", $result2['reply']); ?> <tr class="Karnaf_P_Head"><td colspan="2">Reply #<?=$cnt?> from <?=$result2['r_from']?> [<?=USER_FIELD?>: <?=$result2['r_by']?> / IP: <?=IsKarnafAdminSession()?$result2['ip']:"HIDDEN"?>] at <?=showtime($result2['r_time'])?></td></tr> <tr> <td class="ticket_replies" colspan="2"><?=show_board_body($reply)?></td> </tr> <? } if(!$cnt) echo "<tr><td colspan=\"2\" align=\"center\">*** None ***</td></tr>\r\n"; sql_free_result($query2); ?> </table> </td></tr> <? } ?> <tr class="Karnaf_Head2"> <td colspan="2" align="center">Add new reply</td> </tr> <tr>
</td> <td> <?php if (!empty($result['rep_u'])) { echo $result['rep_u'] . " (" . $result['rep_g'] . ")"; } else { echo $result['rep_g']; } ?> </td> <td><?php echo $result['spriority']; ?> </td> <td><?php echo showtime($result['open_time']); ?> </td> <td><?php echo $action_cnt + $reply_cnt; ?> </td> <td> <?php if ($result['close_time']) { echo do_duration($result['close_time'] - $result['open_time']); } else { echo do_duration(time() - $result['open_time']); } ?> </td>
function delev($id, $history) { global $EVENTS_TB, $CAT_TB, $mth, $notimeentry; echo "<div class=titlefont>" . translate("Delete event") . " ?</div>"; echo "<hr/>"; $query = "select id,title,cat_name,description,starttime,endtime,day,month,year,approved,url,email,user,timestamp from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where id='{$id}'"; $result = mysql_query($query); $row = mysql_fetch_object($result); echo "<div class=titlefont><u>" . stripslashes($row->title) . "</u></div><br/>\n"; echo "<div class=normalfont>\n"; echo "<b>" . translate("Date") . " : </b>" . $row->day . " " . $mth[$row->month] . " " . $row->year . " \n"; if ($notimeentry == 0) { showtime($row->starttime, $row->endtime, 2); } echo "<br/>\n<b>" . translate("Category") . " : </b>" . stripslashes($row->cat_name) . "<br/>\n"; echo "<br/><b>" . translate("Event Description") . ": </b><br/>\n<blockquote>"; echo stripslashes($row->description); echo "</blockquote><br/>"; if ($row->email) { echo "<br/><b>" . translate("Email") . " : </b><a href=mailto:" . $row->email . ">" . $row->email . "</a>\n"; } if ($row->url) { echo "<br/><b>" . translate("More info") . " : </b><a href="; // for compatibility with up to 0.5 version if (trim($row->url) != "" && strtolower(substr($row->url, 0, 4)) != "http") { echo "http://" . $row->url . " target=_blank>http://" . $row->url . "</a>\n"; } else { echo $row->url . " target=_blank>" . $row->url . "</a>\n"; } } echo "<br/><br/><b>" . translate("User") . " : </b>" . $row->user . "<br/>\n"; $tyear = substr($row->timestamp, 0, 4); $tmonth = substr($row->timestamp, 5, 2); if (substr($tmonth, 0, 1) == "0") { $tmonth = str_replace("0", "", $tmonth); } $tday = substr($row->timestamp, 8, 2); if (substr($tday, 0, 1) == "0") { $tday = str_replace("0", "", $tday); } $ttime = substr($row->timestamp, 11, 8); echo "<b>" . translate("Time added or updated") . " : </b>" . $tday . " " . $mth[$tmonth] . " " . $tyear . " " . date("H:i:s", mktime(substr($ttime, 0, 2), substr($ttime, 3, 2), substr($ttime, 6, 2))) . "<br/>\n"; echo "</div><br/>"; echo "<div class=titlefont><a href='cal_event.php?op=delevok&id={$id}&history={$history}'>" . translate("Yes, delete event !") . "</a></div>"; back(); }
<?php if (is_array($list)) { foreach ($list as $key => $v) { ?> <tr class="gradeX"> <td><input type="checkbox" /></td> <th><?php echo $v["id"]; ?> </th> <th><?php echo $v["comment"]; ?> </th> <th><?php echo showtime($v[pubtime]); ?> </th> <th><a onclick="return confirm('Sure want to RESET?')" href="<?php echo U('Admin/Landscape/replkyouttrash', 'id=' . $v['id']); ?> "><button>Reset</button></a></th> </tr><?php } } ?> </tbody> </table> </div> </div> </div>
function week($week, $date) { global $EVENTS_TB, $CAT_TB, $USER_TB, $mth, $week, $m, $d, $y, $ld, $fd, $weekstartday, $calstartyear, $caladvanceyear, $unapprovedclr, $shortdesclen, $showuserentry, $uname, $notimeentry; // View events for specific user if (!isset($_POST['huser'])) { $huser = ''; } else { $huser = $_POST['huser']; } if (!$date) { $year = $y; $month = $m; $day = $d; } else { $year = substr($date, 0, 4); $month = substr($date, 5, 2); $day = substr($date, 8, 2); } // offset to get correct day calculation when "date" is sent $day_offset = date("w", mktime(0, 0, 0, $month, $day, $year)); $dayoff = 0; // use to get back original url "date" while ($day_offset > date("w")) { $day--; $day_offset = date("w", mktime(0, 0, 0, $month, $day, $year)); $dayoff++; } while ($day_offset < date("w")) { $day++; $day_offset = date("w", mktime(0, 0, 0, $month, $day, $year)); $dayoff--; } // get first day of the week based on "$weekstartday" function firstDayOfWeek($year, $month, $day) { global $fd, $weekstartday; $dayOfWeek = date("w"); $sunday_offset = $dayOfWeek * 60 * 60 * 24; $startday_offset = ($weekstartday - 1) * 60 * 60 * 24; $fd = date("Y-m-d", mktime(0, 0, 0, $month, $day + 1, $year) - $sunday_offset + $startday_offset); return $fd; } firstDayOfWeek($year, $month, $day); // get last day of the week based on "$weekstartday" function lastDayOfWeek($year, $month, $day) { global $ld, $weekstartday; $dayOfWeek = date("w"); $saturday_offset = (6 - $dayOfWeek) * 60 * 60 * 24; $startday_offset = ($weekstartday - 1) * 60 * 60 * 24; $ld = date("Y-m-d", mktime(0, 0, 0, $month, $day + 1, $year) + $saturday_offset + $startday_offset); return $ld; } lastDayOfWeek($year, $month, $day); // display header with week number echo "<table class=headerfont border=0 width=100% cellspacing=0><tr><td>" . translate("Events from "); $fdy = substr($fd, 0, 4); $fdm = substr($fd, 5, 2); if (substr($fdm, 0, 1) == "0") { $fdm = str_replace("0", "", $fdm); } $fdd = substr($fd, 8, 2); echo $fdd . " " . $mth[$fdm] . " " . $fdy; echo " " . translate("till") . " "; $ldy = substr($ld, 0, 4); $ldm = substr($ld, 5, 2); if (substr($ldm, 0, 1) == "0") { $ldm = str_replace("0", "", $ldm); } $ldd = substr($ld, 8, 2); echo $ldd . " " . $mth[$ldm] . " " . $ldy; $weeknumber = weekNumber($day + $dayoff, $month, $year); if ($ldy > $y + $caladvanceyear) { $weeknumber = 53; } // to ensure weeks cannot go beyond restricted dates if ($fdy < $calstartyear) { $weeknumber = 1; } // to ensure weeks cannot go beyond restricted dates echo " (" . translate("week number") . " : " . $weeknumber . ")\n"; $gdy = $ldy; $gdm = $ldm; if ($gdy > $y + $caladvanceyear) { $gdy = $fdy; $gdm = $fdm; } echo " <a href=calendar.php?op=cal&month={$gdm}&year={$gdy}"; urlvar($uname); echo " ><img src=\"../images/month.gif\" border=0 alt='" . translate("View month") . " " . $mth[$gdm] . "'/></a>"; echo "<br/>(" . translate("Week starts") . " " . $week[$weekstartday + 1] . ")\n"; echo "</td></tr></table>"; // display hyperlinks to previous and next week $calendyear = $y + $caladvanceyear; echo "<table width=100% border=0><tr><td align=left><div class=menufont>"; if ($year > $calstartyear || $fdm >= 1 && $fdy == $calstartyear) { echo "<a href=cal_adminweek.php?op=week&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day - 7, $year)); urlvar($uname); echo " ><< " . translate("Previous week") . "</a> "; } if ($ldy <= $calendyear) { echo "<a href=cal_adminweek.php?op=week&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $day + 7, $year)); urlvar($uname); echo " >" . translate("Next week") . " >> </a>\n"; } // display the hyperlinks to each day echo "</div></td><td align=right><div class=menufont><b>" . translate("Go to") . ": </b> "; $afd = $fd; $ald = date("Y-m-d", mktime(0, 0, 0, $ldm, $ldd + 1, $ldy)); while ($afd != $ald) { $fdy = substr($afd, 0, 4); $fdm = substr($afd, 5, 2); if (substr($fdm, 0, 1) == "0") { $fdm = str_replace("0", "", $fdm); } $fdd = substr($afd, 8, 2); $weekday = date("w", mktime(12, 0, 0, $fdm, $fdd, $fdy)); $weekday++; echo "<a href='#{$week[$weekday]}' >"; echo ucfirst($week[$weekday]) . " - " . $fdd; echo "</a> "; $afd = date("Y-m-d", mktime(0, 0, 0, $fdm, $fdd + 1, $fdy)); } echo "</div></td></tr></table>"; $ld = date("Y-m-d", mktime(0, 0, 0, $ldm, $ldd + 1, $ldy)); while ($fd != $ld) { $fdy = substr($fd, 0, 4); $fdm = substr($fd, 5, 2); if (substr($fdm, 0, 1) == "0") { $fdm = str_replace("0", "", $fdm); } $fdd = substr($fd, 8, 2); // display the day header echo "<table class=titlefont width=100% border=0 cellspacing=0><tr><td valign=middle align=left><div class=titlefont>"; $weekday = date("w", mktime(12, 0, 0, $fdm, $fdd, $fdy)); $weekday++; echo "<a class=none name='{$week[$weekday]}'>"; echo ucfirst($week[$weekday]) . " "; echo "<a class=titlefont href='cal_adminday.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $fdm, $fdd, $fdy)); urlvar($uname); echo "'>" . $fdd . "</a>" . " " . ucfirst($mth[$fdm]) . " " . $fdy; echo "</a> <a href='cal_event.php?op=eventform&add_day={$fdd}&add_month={$fdm}&add_year={$fdy}'><img src='../images/plus.gif' alt='" . translate("Add Event") . "' border=0 valign=middle width=11 height=11/></a>"; echo "</div></td></tr></table>"; // query and display events echo "<table class=weekevent width=100% border=0 cellspacing=0><tr><td>"; $query = "select id,user,title,description,url,email,cat_name,starttime,endtime,day,month,year,approved from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where day='{$fdd}' and month='{$fdm}' and year='{$fdy}' "; if ($uname != "" && $uname != "-") { $query = $query . " and " . $EVENTS_TB . ".user='******' "; } $query = $query . " order by starttime,title ASC"; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { echo "<br/>"; } while ($row = mysql_fetch_object($result)) { if ($row->approved == '0') { echo "<table class=weekevent width=100% border=0><tr><td bgcolor='{$unapprovedclr}'>"; } if ($notimeentry == 0) { if ($row->starttime == '') { echo "<div><li>"; } else { showtime($row->starttime, $row->endtime, 0); } } else { echo "<div><li>"; } echo "<b>" . stripslashes($row->title); if ($showuserentry == 1) { echo " <" . $row->user . ">"; } echo "</b>"; if ($notimeentry == 1 || $row->starttime == '') { echo "</li></div>"; } else { echo "<br/>\n"; } echo "<b>" . translate("Category") . " : " . "</b>" . stripslashes($row->cat_name) . "<br/>"; $de = $row->description; //$de = str_replace("<br />","",$row->description); echo substr(stripslashes($de), 0, $shortdesclen); if ($row->email != "" || $row->url != "" || strlen($de) > $shortdesclen) { echo " ...\n"; } else { echo "\n"; } echo "<br/>"; echo "<div class=menufont><a href=cal_event.php?op=view&id=" . $row->id . ">" . translate("View event") . "</a>\n"; echo " - <a href=cal_event.php?op=edit&id=" . $row->id . ">" . translate("Edit event") . "</a>\n"; echo " - <a href=cal_event.php?op=delev&id=" . $row->id . ">" . translate("Delete event") . "</a>\n"; if ($row->approved == '0') { echo " - <a href=calendar.php?op=approve&id=" . $row->id . ">" . translate("Approve") . "</a>\n"; } echo "</div>\n"; echo "<hr/>"; if ($row->approved == '0') { echo "</td></tr></table>\n"; } } $fd = date("Y-m-d", mktime(0, 0, 0, $fdm, $fdd + 1, $fdy)); echo "</td></tr></table>"; } // display form functions echo "<table border=0 width=100%><tr><td align=left width=50%>"; echo "<table width=100 cellspacing=0 cellpadding=2 align=left class=txtbox><tr><td bgcolor='{$unapprovedclr}' align=center><div class=normalfont>" . translate("Unapproved events") . "</div></td></tr></table>\n</td>"; echo "<td align=right valign=middle width=50%>"; echo "<form><div class=menufont>\n"; echo "<b>" . translate("Go to week") . " </b>"; // get week number echo "<select name=goweek onchange=\"javascript:gotoweek(this);\">\n"; for ($i = 1; $i < 53; $i++) { echo "\t<option value=" . $i; if ($weeknumber == $i) { echo " selected "; } echo ">" . $i . "\n"; } if (showWeek53($year) > 52) { for ($i = 53; $i <= showWeek53($year); $i++) { echo "\t<option value=" . $i; if ($weeknumber == $i) { echo " selected "; } echo ">" . $i . "\n"; } } echo "</select>\n"; echo "<b>" . translate("or month") . " </b>"; // get months echo "<select name=gomonth onchange=\"javascript:gotomonth(this);\">\n"; for ($i = 1; $i < 13; $i++) { echo "\t<option value=" . $i; if ($ldm == $i) { echo " selected "; } echo ">" . ucfirst($mth[$i]) . "\n"; } echo "</select> <br/>\n"; // Display the users to be selected echo "<b>" . translate("View events of user") . ": </b> "; // get users $uquery = "select username,user_id from " . $USER_TB; $uresult = mysql_query($uquery); echo "<select name=huser onchange=\"Javascript:seeuser(this);\">\n"; echo "\t<option value='-'"; if ($uname == "-" || $uname == "") { echo " selected "; } echo ">--\n"; while ($urow = mysql_fetch_object($uresult)) { echo "\t<option value='{$urow->username}'"; if ($uname == "{$urow->username}") { echo " selected "; } echo ">" . $urow->username . "\n"; } echo "</select> \n"; echo "</div></form>"; echo "</td></tr></table>"; }
echo $val['title']; ?> </a> </div> <div class="five columns" style="height:3em;overflow:hidden;"> <?php echo $val['content']; ?> </div> <div class="one column"> <a href="<?php echo U('Blog/blogInfo', 'id=' . $val['id'] . '& user_id=' . $val['user_id']); ?> "><?php echo $val['comment_num']; ?> </a> </div> <div class="two columns"> <?php echo showtime($val['pubtime']); ?> </div> <div class="one column"><a class="btn btn-default btn-sm delConfirm" onclick="conf(this)" value="<?php echo $val['id']; ?> ">Delete</a></div> </div><?php } } }
function setupLoggedInUser() { showtime('start-user'); if (empty($_SESSION['username'])) { session_destroy(); header("Location: /"); exit; } define('EGS_USERNAME', $_SESSION['username']); // If the user has selected a company using the company selector // update their lastcompanylogin value and save this value to their session if (isset($_GET['companyselector'])) { $access = DataObjectFactory::Factory('Usercompanyaccess'); if ($access->loadBy(array('username', 'usercompanyid'), array(EGS_USERNAME, $_GET['companyselector']))) { $user = getCurrentUser(); $user->update(EGS_USERNAME, 'lastcompanylogin', $_GET['companyselector']); $_SESSION['EGS_COMPANY_ID'] = $_GET['companyselector']; } } // Define the EGS_COMPANY_ID global constant either from // 1 - saved session variable // 2 - users lastcompanylogin // 3 - System Company that is linked from user person_id via person company_id // 4 - first entry returned from User Company Access that is enabled for this user if (isset($_SESSION['EGS_COMPANY_ID']) && $_SESSION['EGS_COMPANY_ID'] != 'EGS_COMPANY_ID') { define('EGS_COMPANY_ID', $_SESSION['EGS_COMPANY_ID']); } else { $user = getCurrentUser(); $lcl = $user->lastcompanylogin; if (!empty($lcl)) { define('EGS_COMPANY_ID', $lcl); } elseif (!is_null($user->person_id)) { $sc = DataObjectFactory::Factory('SystemCompany'); $sc->loadBy('company_id', $user->persondetail->company_id); if ($sc->isLoaded()) { define('EGS_COMPANY_ID', $sc->usercompanyid); } else { $uca = DataObjectFactory::Factory('UserCompanyAccess'); $companies = $uca->getCompanies($_SESSION['username']); if (count($companies) > 0) { define('EGS_COMPANY_ID', $companies[0]['usercompanyid']); } else { define('EGS_COMPANY_ID', $person->usercompanyid); } } } $_SESSION['EGS_COMPANY_ID'] = EGS_COMPANY_ID; } showtime('end-user'); }
header('location: /page/' . $taltol_page); exit; } } } // 获取最近文章列表 if ($page == 0) { $page = 1; } $query_sql = "SELECT a.id,a.cid,a.uid,a.ruid,a.title,a.addtime,a.edittime,a.comments,c.name as cname,u.avatar as uavatar,u.name as author,ru.name as rauthor\r\n FROM `yunbbs_articles` a \r\n LEFT JOIN `yunbbs_categories` c ON c.id=a.cid\r\n LEFT JOIN `yunbbs_users` u ON a.uid=u.id\r\n LEFT JOIN `yunbbs_users` ru ON a.ruid=ru.id\r\n ORDER BY `edittime` DESC LIMIT " . ($page - 1) * $options['list_shownum'] . "," . $options['list_shownum']; $query = $DBS->query($query_sql); $articledb = array(); while ($article = $DBS->fetch_array($query)) { // 格式化内容 $article['addtime'] = showtime($article['addtime']); $article['edittime'] = showtime($article['edittime']); $articledb[] = $article; } unset($article); $DBS->free_result($query); // 页面变量 $title = $options['name'] . ' - page ' . $page; $site_infos = get_site_infos(); $newest_nodes = get_newest_nodes(); if (count($newest_nodes) == $options['newest_node_num']) { $bot_nodes = get_bot_nodes(); } $show_sider_ad = "1"; $links = get_links(); if ($options['site_des']) { $meta_des = htmlspecialchars(mb_substr($options['site_des'], 0, 150, 'utf-8')) . ' - page ' . $page;
if (!defined('IN_SAESPOT')) { exit('error: 403 Access Denied'); } echo ' <div class="nav-title"> <i class="fa fa-angle-double-right"></i> <a href="/nodes/', $c_obj['id'], '">', $c_obj['name'], '</a> (', $c_obj['articles'], ') <div class="c"></div> </div> <div class="main-box"> <div class="topic-title"> <div class="topic-title-main float-left"> <h1>', $t_obj['title'], '</h1> <div class="topic-title-date"> <i class="fa fa-user"></i> <a href="/user/', $t_obj['uid'], '">', $t_obj['author'], '</a> <i class="fa fa-calendar"></i> <time datetime="', showtime2($t_obj['edittime']), '" pubdate="pubdate" data-updated="true">', showtime($t_obj['addtime']), '</time> <i class="fa fa-eye"></i> ', $t_obj['views'], '阅读'; if ($cur_user && $cur_user['flag'] > 4) { if (!$t_obj['closecomment']) { echo ' <i class="fa fa-comments"></i> <a href="#new-comment">回复</a>'; } } echo ' </div> </div> <div class="detail-avatar"><a href="/user/', $t_obj['uid'], '">'; if ($is_spider) { echo '<img src="/avatar/large/', $t_obj['uavatar'], '.png" alt="', $t_obj['author'], '" />'; } else { echo '<img src="/static/grey.gif" data-original="/avatar/large/', $t_obj['uavatar'], '.png" alt="', $t_obj['author'], '" />'; } echo ' </a></div> <div class="c"></div>