Empty commit

This commit is contained in:
Git 2013-10-13 08:01:01 +00:00
parent 7c8739fe5e
commit 7100fdf7a7
30 changed files with 830 additions and 345 deletions

View File

@ -1,8 +1,8 @@
<?
class CalendarView {
private static $Days = array('S','M','T','W','T','F','S');
private static $Headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
private static $Days = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
private static $Headings = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
private static $Events;
public static function render_title($Month, $Year) {
@ -18,13 +18,14 @@ public static function render_title($Month, $Year) {
}
?>
<h1 class="center">
<a href="tools.php?action=calendar&amp;month=<?=$PreviousMonth?>&amp;year=<?=$PreviousYear?>"><</a>
<?=date("F", mktime(0, 0, 0, $Month, 10)) . " " . $Year?>
<a href="tools.php?action=calendar&amp;month=<?=$NextMonth?>&amp;year=<?=$NextYear?>">></a>
<a href="tools.php?action=calendar&amp;month=<?=$PreviousMonth?>&amp;year=<?=$PreviousYear?>">&lt;</a>
<?=date("F", mktime(0, 0, 0, $Month, 10)) . " $Year"?>
<a href="tools.php?action=calendar&amp;month=<?=$NextMonth?>&amp;year=<?=$NextYear?>">&gt;</a>
</h1>
<input type="hidden" id="month" value="<?=$Month?>"/>
<input type="hidden" id="year" value="<?=$Year?>"/>
<? }
<input type="hidden" id="month" value="<?=$Month?>" />
<input type="hidden" id="year" value="<?=$Year?>" />
<?
}
private static function get_events_on($Day, $Events) {
// Linear search, Lol.
@ -46,11 +47,10 @@ private static function render_events_day($Day, $Events) {
$Tooltip = $Event['Title'] . " - " . Calendar::$Categories[$Event['Category']] . " - " . Calendar::$Importances[$Event['Importance']];
?>
<p><a href="#" class="event_day tooltip" title="<?=$Tooltip?>" data-gazelle-id="<?=$Event['ID']?>" style="color: <?=$Color?>;"><?=Format::cut_string($Event['Title'], 8, true)?></a></p>
<? }
<?
}
}
public static function render_calendar($Month, $Year, $Events) {
$RunningDay = date('w',mktime(0, 0, 0, $Month, 1, $Year));
$DaysInMonth = date('t',mktime(0 ,0 ,0, $Month, 1, $Year));
@ -60,19 +60,23 @@ public static function render_calendar($Month, $Year, $Events) {
?>
<table class="calendar">
<? foreach (self::$Headings as $Heading) { ?>
<tr>
<? foreach (self::$Headings as $Heading) { ?>
<td class="calendar-row calendar-heading">
<strong><?=$Heading?></strong>
</td>
<? } ?>
<? } ?>
</tr>
<tr class="calendar-row">
<? for ($x = 0; $x < $RunningDay; $x++) { ?>
<? for ($x = 0; $x < $RunningDay; $x++) { ?>
<td class="calendar-day-np"></td>
<? $DaysThisWeek++;
}
<?
$DaysThisWeek++;
}
for ($i = 1; $i <= $DaysInMonth; $i++) { ?>
for ($i = 1; $i <= $DaysInMonth; $i++) {
?>
<td class="calendar-day">
<div class="day-events">
<? self::render_events_day($i, $Events); ?>
@ -81,29 +85,32 @@ public static function render_calendar($Month, $Year, $Events) {
<?=$i?>
</div>
</td>
<? if ($RunningDay == 6) { ?>
</tr>
<? if (($DayCounter+1) != $DaysInMonth) { ?>
<tr class="calendar-row">
<? }
$RunningDay = -1;
$DaysThisWeek = 0;
<? if ($RunningDay == 6) { ?>
</tr>
<? if (($DayCounter + 1) != $DaysInMonth) { ?>
<tr class="calendar-row">
<?
}
$DaysThisWeek++;
$RunningDay++;
$DayCounter++;
$RunningDay = -1;
$DaysThisWeek = 0;
}
$DaysThisWeek++;
$RunningDay++;
$DayCounter++;
}
if ($DaysThisWeek < 8) {
for ($x = 1; $x <= (8 - $DaysThisWeek); $x++) { ?>
<td class="calendar-day-np"></td>
<? }
if ($DaysThisWeek < 8) {
for ($x = 1; $x <= (8 - $DaysThisWeek); $x++) {
?>
<td class="calendar-day-np"></td>
<?
}
}
?>
</tr>
</table>
</table>
<?
echo $Calendar;
}
echo $Calendar;
}
}

View File

@ -1,7 +1,8 @@
<?
class DonationsView {
public static function render_mod_donations($UserID) { ?>
public static function render_mod_donations($UserID) {
?>
<table class="layout" id="donation_box">
<tr class="colhead">
<td colspan="2">
@ -59,13 +60,15 @@ public static function render_mod_donations($UserID) { ?>
public static function render_donor_stats($UserID) {
$OwnProfile = G::$LoggedUser['ID'] == $UserID;
if (check_perms("users_mod") || $OwnProfile || Donations::is_visible($UserID)) { ?>
if (check_perms("users_mod") || $OwnProfile || Donations::is_visible($UserID)) {
?>
<div class="box box_info box_userinfo_donor_stats">
<div class="head colhead_dark">Donor Statistics</div>
<ul class="stats nobullet">
<?
if (Donations::is_donor($UserID)) {
if (check_perms('users_mod') || $OwnProfile) { ?>
if (check_perms('users_mod') || $OwnProfile) {
?>
<li>
Total donor points: <?=Donations::get_total_rank($UserID)?>
</li>
@ -96,16 +99,17 @@ public static function render_donor_stats($UserID) {
public static function render_profile_rewards($EnabledRewards, $ProfileRewards) {
$Text = new Text;
for ($i = 1; $i <= 4; $i++) {
if (isset($EnabledRewards['HasProfileInfo' . $i]) && $ProfileRewards['ProfileInfo' . $i]) { ?>
<div class="box">
<div class="head" style="height: 13px;">
<span style="float: left;"><?=!empty($ProfileRewards['ProfileInfoTitle' . $i]) ? display_str($ProfileRewards['ProfileInfoTitle' . $i]) : "Extra Profile " . ($i + 1)?></span>
<span style="float: right;"><a href="#" onclick="$('#profilediv_<?=$i?>').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Hide</a></span>
</div>
<div class="pad" id="profilediv_<?=$i?>">
<? echo $Text->full_format($ProfileRewards['ProfileInfo' . $i]); ?>
</div>
</div>
if (isset($EnabledRewards['HasProfileInfo' . $i]) && $ProfileRewards['ProfileInfo' . $i]) {
?>
<div class="box">
<div class="head" style="height: 13px;">
<span style="float: left;"><?=!empty($ProfileRewards['ProfileInfoTitle' . $i]) ? display_str($ProfileRewards['ProfileInfoTitle' . $i]) : "Extra Profile " . ($i + 1)?></span>
<span style="float: right;"><a href="#" onclick="$('#profilediv_<?=$i?>').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Hide</a></span>
</div>
<div class="pad" id="profilediv_<?=$i?>">
<? echo $Text->full_format($ProfileRewards['ProfileInfo' . $i]); ?>
</div>
</div>
<?
}
}
@ -147,7 +151,7 @@ public static function render_donation_history($DonationHistory) {
<strong>Reason</strong>
</td>
</tr>
<? foreach ($DonationHistory as $Donation) { ?>
<? foreach ($DonationHistory as $Donation) { ?>
<tr class="row<?=$Row?>">
<td>
<?=display_str($Donation['Source'])?> (<?=Users::format_username($Donation['AddedBy'])?>)
@ -172,8 +176,9 @@ public static function render_donation_history($DonationHistory) {
</td>
</tr>
<?
$Row = $Row == 'b' ? 'a' : 'b';
} ?>
$Row = $Row === 'b' ? 'a' : 'b';
}
?>
</tbody>
</table>
</div>

View File

@ -59,12 +59,12 @@ function make_tree() {
TreePosition,
TreeLevel
FROM invite_tree AS it
JOIN users_main AS um ON um.ID=it.UserID
JOIN users_info AS ui ON ui.UserID=it.UserID
WHERE TreeID=$TreeID
AND TreePosition>$TreePosition".
($MaxPosition ? " AND TreePosition<$MaxPosition" : '')."
AND TreeLevel>$TreeLevel
JOIN users_main AS um ON um.ID = it.UserID
JOIN users_info AS ui ON ui.UserID = it.UserID
WHERE TreeID = $TreeID
AND TreePosition > $TreePosition".
($MaxPosition ? " AND TreePosition < $MaxPosition" : '')."
AND TreeLevel > $TreeLevel
ORDER BY TreePosition");
$PreviousTreeLevel = $TreeLevel;
@ -117,37 +117,38 @@ function make_tree() {
// Manage tree depth
if ($TreeLevel > $PreviousTreeLevel) {
for ($i = 0; $i < $TreeLevel - $PreviousTreeLevel; $i++) {
echo "<ul class=\"invitetree\">\n\t<li>";
echo "\n\n<ul class=\"invitetree\">\n\t<li>\n";
}
} elseif ($TreeLevel < $PreviousTreeLevel) {
for ($i = 0; $i < $PreviousTreeLevel - $TreeLevel; $i++) {
echo "\t</li>\n</ul>";
echo "\t</li>\n</ul>\n";
}
echo "\t</li>\n<li>";
echo "\t</li>\n\t<li>\n";
} else {
echo "\t</li>\n<li>";
echo "\t</li>\n\t<li>\n";
}
$UserClass = $Classes[$Class]['Level'];
?>
<strong><?=Users::format_username($ID, true, true, ($Enabled != 2 ? false : true), true)?></strong>
<strong><?=Users::format_username($ID, true, true, ($Enabled != 2 ? false : true), true)?></strong>
<?
if (check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) {
$TotalUpload += $Uploaded;
$TotalDownload += $Downloaded;
?>
&nbsp;Uploaded: <strong><?=Format::get_size($Uploaded)?></strong>
&nbsp;Downloaded: <strong><?=Format::get_size($Downloaded)?></strong>
&nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
&nbsp;Uploaded: <strong><?=Format::get_size($Uploaded)?></strong>
&nbsp;Downloaded: <strong><?=Format::get_size($Downloaded)?></strong>
&nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
<?
} else {
$ParanoidCount++;
?>
&nbsp;Hidden
&nbsp;Hidden
<?
}
?>
<? $PreviousTreeLevel = $TreeLevel;
<?
$PreviousTreeLevel = $TreeLevel;
G::$DB->set_query_id($TreeQuery);
}
@ -158,7 +159,8 @@ function make_tree() {
if ($Count) {
?> <p style="font-weight: bold;">
?>
<p style="font-weight: bold;">
This tree has <?=number_format($Count)?> entries, <?=number_format($Branches)?> branches, and a depth of <?=number_format($MaxTreeLevel - $OriginalTreeLevel)?>.
It has
<?
@ -175,7 +177,7 @@ function make_tree() {
$LastClass.='s';
}
}
$LastClass = $ClassCount.' '.$LastClass.' (' . number_format(($ClassCount / $Count) * 100) . '%)';
$LastClass = "$ClassCount $LastClass (" . number_format(($ClassCount / $Count) * 100) . '%)';
$ClassStrings[] = $LastClass;
}
@ -217,7 +219,7 @@ function make_tree() {
echo '; the total amount downloaded was '.Format::get_size($TopLevelDownload);
echo '; and the total ratio is '.Format::get_ratio_html($TopLevelUpload, $TopLevelDownload).'. ';
echo 'These numbers include the stats of paranoid users and will be factored into the invitation giving script.</p>';
echo "These numbers include the stats of paranoid users and will be factored into the invitation giving script.\n\t\t</p>\n";
if ($ParanoidCount) {
echo '<p style="font-weight: bold;">';
@ -233,8 +235,8 @@ function make_tree() {
}
}
?>
<br />
<?=$Tree?>
<br />
<?= $Tree?>
</div>
<?
G::$DB->set_query_id($QueryID);

View File

@ -138,8 +138,6 @@ public static function get_hyped_artists($Limit = 100) {
return $Response;
}
public static function clear_cache($Username, $UserID) {
$Response = G::$Cache->get_value("lastfm_clear_cache_$UserID");
if (empty($Response)) {

View File

@ -2,29 +2,37 @@
class LastFMView {
/* Renders the sidebar shown on user profiles
*
* @param $LastFMUsername
* @param $UserID
* @param $OwnProfile
*/
public static function render_sidebar($LastFMUsername, $UserID, $OwnProfile) {
$LastFMInfo = LastFM::get_user_info($LastFMUsername);
?>
<div class="box box_info box_lastfm">
<div class="head colhead_dark">Last.fm</div>
<ul class="stats nobullet">
<li>
Username: <a id="lastfm_username" href="<?=$LastFMInfo['user']['url']?>" target="_blank" title="<?=$LastFMInfo['user']['name']?> on Last.fm: <?=number_format($LastFMInfo['user']['playcount'])?> plays, <?=number_format($LastFMInfo['user']['playlists'])?> playlists."><?=$LastFMUsername?></a>
</li>
<div id="lastfm_stats"<?=$OwnProfile ? ' data-uid="1"' : ''?>>
</div>
<li>
<a href="#" id="lastfm_expand" onclick="return false" class="brackets">Show more info</a>
<? //Append the reload stats button only if allowed on the current user page.
$Response = G::$Cache->get_value("lastfm_clear_cache_$UserID");
if (empty($Response)) { ?>
<span id="lastfm_reload_container">
<a href="#" id="lastfm_reload" onclick="return false" class="brackets">Reload stats</a>
</span>
<? } ?>
</li>
</ul>
</div>
<?
$LastFMInfo = LastFM::get_user_info($LastFMUsername);
?>
<div class="box box_info box_lastfm">
<div class="head colhead_dark">Last.fm</div>
<ul class="stats nobullet">
<li>
Username: <a id="lastfm_username" href="<?=$LastFMInfo['user']['url']?>" target="_blank" title="<?=$LastFMInfo['user']['name']?> on Last.fm: <?=number_format($LastFMInfo['user']['playcount'])?> plays, <?=number_format($LastFMInfo['user']['playlists'])?> playlist<?=$LastFMInfo['user']['playlists'] != 1 ? 's' : ''?>."><?=$LastFMUsername?></a>
</li>
<div id="lastfm_stats"<?=$OwnProfile ? ' data-uid="1"' : ''?>>
</div>
<li>
<a href="#" id="lastfm_expand" onclick="return false;" class="brackets">Show more info</a>
<?
//Append the reload stats button only if allowed on the current user page.
$Response = G::$Cache->get_value("lastfm_clear_cache_$UserID");
if (empty($Response)) {
?>
<span id="lastfm_reload_container">
<a href="#" id="lastfm_reload" onclick="return false;" class="brackets">Reload stats</a>
</span>
<? } ?>
</li>
</ul>
</div>
<?
}
}
}

View File

@ -4,11 +4,13 @@ class SiteHistoryView {
public static function render_linkbox() {
if (check_perms('users_mod')
) { ?>
<div class="linkbox">
<a href="sitehistory.php?action=edit" class="brackets">Create</a>
</div>
<? }
) {
?>
<div class="linkbox">
<a href="sitehistory.php?action=edit" class="brackets">Create new event</a>
</div>
<?
}
}
public static function render_events($Events) {
@ -16,36 +18,38 @@ public static function render_events($Events) {
$Categories = SiteHistory::get_categories();
$SubCategories = SiteHistory::get_sub_categories();
$CanEdit = check_perms('users_mod') ;
foreach ($Events as $Event) { ?>
foreach ($Events as $Event) {
?>
<div class="box">
<div class="head colhead_dark">
<div class="title">
<? if ($CanEdit) { ?>
<? if ($CanEdit) { ?>
<a class="brackets" href="sitehistory.php?action=edit&amp;id=<?=$Event['ID']?>">Edit</a>
<? } ?>
<? } ?>
<?=date('F d, Y', strtotime($Event['Date']));?>
-
<a href="sitehistory.php?action=search&amp;category=<?=$Event['Category']?>">[<?=$Categories[$Event['Category']]?>]</a>
<a href="sitehistory.php?action=search&amp;subcategory=<?=$Event['SubCategory']?>">[<?=$SubCategories[$Event['SubCategory']]?>]</a>
<?=date('F d, Y', strtotime($Event['Date']));?>
-
<a href="sitehistory.php?action=search&amp;category=<?=$Event['Category']?>" class="brackets"><?=$Categories[$Event['Category']]?></a>
<a href="sitehistory.php?action=search&amp;subcategory=<?=$Event['SubCategory']?>" class="brackets"><?=$SubCategories[$Event['SubCategory']]?></a>
<? if (!empty($Event['Url'])) { ?>
<? if (!empty($Event['Url'])) { ?>
<a href="<?=$Event['Url']?>"><?=$Event['Title']?></a>
<? } else { ?>
<? } else { ?>
<?=$Event['Title']?>
<? } ?>
<? } ?>
</div>
<div class="tags">
<? self::render_tags($Event['Tags'])?>
</div>
</div>
<? if (!empty($Event['Body'])) { ?>
<div class="body">
<?=$Text->full_format($Event['Body'])?>
</div>
<? } ?>
<? if (!empty($Event['Body'])) { ?>
<div class="body">
<?=$Text->full_format($Event['Body'])?>
</div>
<? } ?>
</div>
<? }
<?
}
}
private static function render_tags($Tags) {
@ -53,51 +57,58 @@ private static function render_tags($Tags) {
natcasesort($Tags);
$FormattedTags = '';
foreach ($Tags as $Tag) {
$FormattedTags .= "<a href='sitehistory.php?action=search&amp;tags=". $Tag . "'>" . $Tag . "</a>, ";
$FormattedTags .= "<a href=\"sitehistory.php?action=search&amp;tags=$Tag\">$Tag" . "</a>, ";
}
echo rtrim($FormattedTags, ', ');
}
public static function render_months($Months) { ?>
<div class="box">
<div class="head">Calendar</div>
<div class="pad">
<? $Year = "";
foreach ($Months as $Month) {
if ($Month['Year'] != $Year) {
$Year = $Month['Year'];
echo "<h2>$Year</h2>";
} ?>
<a style="margin-left: 5px;" href="sitehistory.php?month=<?=$Month['Month']?>&amp;year=<?=$Month['Year']?>"><?=$Month['MonthName']?></a>
<? } ?>
</div>
<div class="head">Calendar</div>
<div class="pad">
<?
$Year = "";
foreach ($Months as $Month) {
if ($Month['Year'] != $Year) {
$Year = $Month['Year'];
echo "<h2>$Year</h2>";
}
?>
<a style="margin-left: 5px;" href="sitehistory.php?month=<?=$Month['Month']?>&amp;year=<?=$Month['Year']?>"><?=$Month['MonthName']?></a>
<? } ?>
</div>
<? }
</div>
<?
}
public static function render_search() { ?>
<div class="box">
<div class="head">Search</div>
<div class="pad">
<form class="search_form" action="sitehistory.php" method="GET">
<form class="search_form" action="sitehistory.php" method="get">
<input type="hidden" name="action" value="search" />
<input type="text" id="title" name="title" size="20" placeholder="Title"/>
<input type="text" id="title" name="title" size="20" placeholder="Title" />
<br /><br/>
<input type="text" id="tags" name="tags" size="20" placeholder="Comma separated tags"/>
<input type="text" id="tags" name="tags" size="20" placeholder="Comma-separated tags" />
<br /><br/>
<select name="category" id="category">
<option value="0">Choose a category</option>
<? $Categories = SiteHistory::get_categories();
foreach ($Categories as $Key => $Value) { ?>
<option <?=$Key == $Event['Category'] ? 'selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
<option value="0">Choose a category</option>
<?
$Categories = SiteHistory::get_categories();
foreach ($Categories as $Key => $Value) {
?>
<option<?=$Key == $Event['Category'] ? ' selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
</select>
<br /><br/>
<select name="subcategory">
<option value="0">Choose a subcategory</option>
<? $SubCategories = SiteHistory::get_sub_categories();
foreach ($SubCategories as $Key => $Value) { ?>
<option <?=$Key == $Event['SubCategory'] ? 'selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
<option value="0">Choose a subcategory</option>
<?
$SubCategories = SiteHistory::get_sub_categories();
foreach ($SubCategories as $Key => $Value) {
?>
<option<?=$Key == $Event['SubCategory'] ? ' selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
</select>
<br /><br/>
<input value="Search" type="submit" />
@ -107,13 +118,13 @@ public static function render_search() { ?>
<? }
public static function render_edit_form($Event) { ?>
<form id="event_form" method="POST">
<? if ($Event) { ?>
<input type="hidden" name="action" value="take_edit" />
<input type="hidden" name="id" value="<?=$Event['ID']?>" />
<? } else { ?>
<input type="hidden" name="action" value="take_create" />
<? } ?>
<form id="event_form" method="post" action="">
<? if ($Event) { ?>
<input type="hidden" name="action" value="take_edit" />
<input type="hidden" name="id" value="<?=$Event['ID']?>" />
<? } else { ?>
<input type="hidden" name="action" value="take_create" />
<? } ?>
<input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" />
<table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
<tr>
@ -131,10 +142,7 @@ public static function render_edit_form($Event) { ?>
<tr>
<td class="label">Date:</td>
<td>
<input type="date" id="date" name="date" class="required"
<? if ($Event) {?>
value="<?=date('Y-m-d', strtotime($Event['Date']))?>"/>
<? } ?>
<input type="date" id="date" name="date" class="required"<?=$Event ? ' value="' . date('Y-m-d', strtotime($Event['Date'])) . '"' : ''?> />
</td>
</tr>
<tr>
@ -142,10 +150,12 @@ public static function render_edit_form($Event) { ?>
<td>
<select id="category" name="category" class="required">
<option value="0">Choose a category</option>
<? $Categories = SiteHistory::get_categories();
foreach ($Categories as $Key => $Value) { ?>
<option <?=$Key == $Event['Category'] ? 'selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
<?
$Categories = SiteHistory::get_categories();
foreach ($Categories as $Key => $Value) {
?>
<option<?=$Key == $Event['Category'] ? ' selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
</select>
</td>
</tr>
@ -154,39 +164,42 @@ public static function render_edit_form($Event) { ?>
<td>
<select id="category" name="sub_category" class="required">
<option value="0">Choose a subcategory</option>
<? $SubCategories = SiteHistory::get_sub_categories();
foreach ($SubCategories as $Key => $Value) { ?>
<option <?=$Key == $Event['SubCategory'] ? 'selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
<? $SubCategories = SiteHistory::get_sub_categories();
foreach ($SubCategories as $Key => $Value) { ?>
<option<?=$Key == $Event['SubCategory'] ? ' selected="selected"' : ''?> value="<?=$Key?>"><?=$Value?></option>
<? } ?>
</select>
</td>
</tr>
<tr>
<td class="label">Tags:</td>
<td>
<input type="text" id="tags" name="tags" placeholder="Comma separated tags, use periods for spaces" size="50" value="<?=$Event['Tags']?>"/>
<input type="text" id="tags" name="tags" placeholder="Comma-separated tags; use periods/dots for spaces" size="50" value="<?=$Event['Tags']?>" />
<select id="tag_list">
<option>Choose tags</option>
<? $Tags = SiteHistory::get_tags();
foreach ($Tags as $Tag) { ?>
<option><?=$Tag?></option>
<? } ?>
<?
$Tags = SiteHistory::get_tags();
foreach ($Tags as $Tag) {
?>
<option><?=$Tag?></option>
<? } ?>
</select>
</td>
</tr>
<tr>
<td class="label">Body:</td>
<td>
<textarea id="body" name="body" cols="90" rows="8" tabindex="1" onkeyup="resize('body')"><?=$Event['Body']?></textarea>
<textarea id="body" name="body" cols="90" rows="8" tabindex="1" onkeyup="resize('body');"><?=$Event['Body']?></textarea>
</td>
</tr>
</table>
<input type="submit" name="submit" value="Submit" />
<? if ($Event) { ?>
<input type="submit" name="delete" value="Delete" />
<? } ?>
<? if ($Event) { ?>
<input type="submit" name="delete" value="Delete" />
<? } ?>
</form>
<? }
<?
}
public static function render_recent_sidebar($Events) { ?>
<div class="box">
@ -194,17 +207,21 @@ public static function render_recent_sidebar($Events) { ?>
<strong><a href="sitehistory.php">Latest site history</a></strong>
</div>
<ul class="stats nobullet">
<? $Categories = SiteHistory::get_categories();
foreach ($Events as $Event) {?>
<?
$Categories = SiteHistory::get_categories();
foreach ($Events as $Event) {
?>
<li>
<a href="sitehistory.php?action=search&amp;category=<?=$Event['Category']?>">[<?=$Categories[$Event['Category']]?>]</a>
<? if (!empty($Event['Url'])) { ?>
<a href="<?=$Event['Url']?>"><?=Format::cut_string($Event['Title'], 20)?></a>
<? } else { ?>
<?=Format::cut_string($Event['Title'], 20)?>
<? }
} ?>
<a href="sitehistory.php?action=search&amp;category=<?=$Event['Category']?>" class="brackets"><?=$Categories[$Event['Category']]?></a>
<? if (!empty($Event['Url'])) { ?>
<a href="<?=$Event['Url']?>"><?=Format::cut_string($Event['Title'], 20)?></a>
<? } else { ?>
<?=Format::cut_string($Event['Title'], 20)?>
<? } ?>
</li>
<? } ?>
</ul>
</div>
<? }
<?
}
}

View File

@ -2,7 +2,8 @@
class Top10View {
public static function render_linkbox($Selected) { ?>
public static function render_linkbox($Selected) {
?>
<div class="linkbox">
<a href="top10.php?type=torrents" class="brackets"><?=self::get_selected_link("Torrents", $Selected == "torrents")?></a>
<a href="top10.php?type=lastfm" class="brackets"><?=self::get_selected_link("Last.fm", $Selected == "lastfm")?></a>
@ -11,22 +12,27 @@ public static function render_linkbox($Selected) { ?>
<a href="top10.php?type=votes" class="brackets"><?=self::get_selected_link("Favorites", $Selected == "votes")?></a>
<a href="top10.php?type=donors" class="brackets"><?=self::get_selected_link("Donors", $Selected == "donors")?></a>
</div>
<? }
<?
}
public static function render_artist_links($Selected, $View) { ?>
public static function render_artist_links($Selected, $View) {
?>
<div class="center">
<a href="top10.php?type=lastfm&amp;category=weekly&amp;view=<?=$View?>" class="brackets tooltip" title="These are the artists with the most Last.fm listeners this week"><?=self::get_selected_link("Weekly Artists", $Selected == "weekly")?></a>
<a href="top10.php?type=lastfm&amp;category=hyped&amp;view=<?=$View?>" class="brackets tooltip" title="These are the the fastest rising artists on Last.fm this week"><?=self::get_selected_link("Hyped Artists", $Selected == "hyped")?></a>
</div>
<? }
public static function render_artist_controls($Selected, $View) { ?>
</div>
<?
}
public static function render_artist_controls($Selected, $View) {
?>
<div class="center">
<a href="top10.php?type=lastfm&amp;category=<?=$Selected?>&amp;view=tiles" class="brackets"><?=self::get_selected_link("Tiles", $View == "tiles")?></a>
<a href="top10.php?type=lastfm&amp;category=<?=$Selected?>&amp;view=list" class="brackets"><?=self::get_selected_link("List", $View == "list")?></a>
</div>
<? }
<?
}
private static function get_selected_link($String, $Selected) {
if ($Selected) {
@ -38,7 +44,7 @@ private static function get_selected_link($String, $Selected) {
public static function render_artist_tile($Artist, $Category) {
switch ($Category) {
case 'weekly':
case 'hyped':
self::render_tile("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
@ -50,20 +56,21 @@ public static function render_artist_tile($Artist, $Category) {
private static function render_tile($Url, $Name, $Image) {
if (!empty($Image)) {
$Name = htmlspecialchars($Name);
?>
$Name = display_str($Name);
?>
<li>
<a href="<?=$Url?><?=$Name?>">
<img class="tooltip large_tile" alt="<?=$Name?>" title="<?=$Name?>" src="<?=ImageTools::process($Image)?>" />
</a>
</li>
<? }
<?
}
}
public static function render_artist_list($Artist, $Category) {
switch ($Category) {
case 'weekly':
case 'hyped':
self::render_list("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
@ -78,12 +85,13 @@ private static function render_list($Url, $Name, $Image) {
$UseTooltipster = !isset(G::$LoggedUser['Tooltipster']) || G::$LoggedUser['Tooltipster'];
$Image = ImageTools::process($Image);
$Title = "title=\"&lt;img class=&quot;large_tile&quot; src=&quot;$Image&quot; alt=&quot;&quot; />\"";
$Name = htmlspecialchars($Name);
?>
$Name = display_str($Name);
?>
<li>
<a class="tooltip_image" <?=$Title?> href="<?=$Url?><?=$Name?>"><?=$Name?></a>
</li>
<? }
<?
}
}
}

View File

@ -966,6 +966,14 @@ CREATE TABLE `sphinx_tg` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `staff_answers` (
`QuestionID` int(10) NOT NULL,
`UserID` int(10) NOT NULL,
`Answer` mediumtext,
`Date` datetime NOT NULL,
PRIMARY KEY (`QuestionID`,`UserID`)
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `staff_blog` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`UserID` int(10) unsigned NOT NULL,
@ -1296,6 +1304,14 @@ CREATE TABLE `torrents_votes` (
CONSTRAINT `torrents_votes_ibfk_1` FOREIGN KEY (`GroupID`) REFERENCES `torrents_group` (`ID`) ON DELETE CASCADE
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `user_questions` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`Question` mediumtext NOT NULL,
`UserID` int(10) NOT NULL,
`Date` datetime NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `users_collage_subs` (
`UserID` int(10) NOT NULL,
`CollageID` int(10) NOT NULL,

1
questions.php Normal file
View File

@ -0,0 +1 @@
<? require('classes/script_start.php'); ?>

View File

@ -0,0 +1,53 @@
<?
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT(true);
if (!check_perms("users_mod")) {
error(403);
}
$ID = $_GET['id'];
if (!is_number($ID)) {
error(404);
}
$DB->query("SELECT ID, Question, UserID, Date FROM user_questions WHERE ID = '$ID'");
$Question = $DB->next_record();
View::show_header("Ask the Staff");
?>
<div class="thin">
<h2>
Answer Question
</h2>
<div class="linkbox">
<a class="brackets" href="questions.php">View questions</a>
<a class="brackets" href="questions.php?action=answers">View staff answers</a>
</div>
<div class="box box2">
<div class="head">
<span>
#<?=$Question['ID']?>
<?=Users::format_username($Question['UserID'])?> - <?=time_diff($Question['Date'])?>
</span>
</div>
<div class="pad">
<?=$Text->full_format($Question['Question'])?>
</div>
</div>
<div class="center box pad">
<form method="POST">
<input type="hidden" name="action" value="take_answer_question" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ID?>" />
<textarea id="answer" class="required" onkeyup="resize('answer');" name="answer" cols="90" rows="8"></textarea>
<div id="buttons" class="center">
<input type="submit" class="submit" id="submit_button" value="Answer" />
</div>
</form>
</div>
</div>
<?
View::show_footer();

View File

@ -0,0 +1,40 @@
<?
View::show_header("Ask the Staff");
$DB->query("
SELECT
sq.UserID, um.Username, count(1) AS Answered
FROM staff_answers AS sq
LEFT JOIN users_main AS um
ON um.ID = sq.UserID
GROUP BY sq.UserID
ORDER BY um.Username ASC");
$Staff = $DB->to_array();
$DB->query("SELECT COUNT(1) FROM user_questions");
list($TotalQuestions) = $DB->next_record();
?>
<div class="thin">
<h2>
Staff Answers
</h2>
<div class="linkbox">
<?
if (check_perms("users_mod")) { ?>
<a class="brackets" href="questions.php">View questions</a>
<? } else { ?>
<a class="brackets" href="questions.php">Ask question</a>
<? } ?>
</div>
<? foreach($Staff as $User) { ?>
<h2>
<a href="questions.php?action=view_answers&amp;userid=<?=$User['UserID']?>"><?=$User['Username']?></a>
- (<?=$User['Answered']?> / <?=$TotalQuestions?>)
</h2>
<? } ?>
</div>
<?
View::show_footer();

View File

@ -0,0 +1,26 @@
<?
View::show_header("Ask the Staff");
?>
<div class="thin">
<h2>
Ask Staff Anything
</h2>
<div class="linkbox">
<a class="brackets" href="questions.php?action=answers">View staff answers</a>
</div>
<div class="center box pad">
<form method="POST">
<input type="hidden" name="action" value="take_ask_question" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<textarea id="question" class="required" onkeyup="resize('question');" name="question" cols="90" rows="8"></textarea>
<div id="buttons" class="center">
<input type="submit" class="submit" id="submit_button" value="Ask question" />
</div>
</form>
</div>
</div>
<?
View::show_footer();

View File

@ -0,0 +1,42 @@
<?
enforce_login();
if (!isset($_REQUEST['action'])) {
if (check_perms('users_mod')) {
include(SERVER_ROOT.'/sections/questions/questions.php');
}
else {
include(SERVER_ROOT.'/sections/questions/ask_question.php');
}
} else {
switch ($_REQUEST['action']) {
case 'take_ask_question':
include(SERVER_ROOT.'/sections/questions/take_ask_question.php');
break;
case 'answer_question':
include(SERVER_ROOT.'/sections/questions/answer_question.php');
break;
case 'take_answer_question':
include(SERVER_ROOT.'/sections/questions/take_answer_question.php');
break;
case 'take_remove_question':
include(SERVER_ROOT.'/sections/questions/take_remove_question.php');
break;
case 'take_remove_answer':
include(SERVER_ROOT.'/sections/questions/take_remove_answer.php');
break;
case 'questions':
include(SERVER_ROOT.'/sections/questions/questions.php');
break;
case 'answers':
include(SERVER_ROOT.'/sections/questions/answers.php');
break;
case 'view_answers':
include(SERVER_ROOT.'/sections/questions/view_answers.php');
break;
default:
error(404);
break;
}
}

View File

@ -0,0 +1,66 @@
<?
if (!check_perms("users_mod")) {
error(404);
}
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT(true);
$DB->query("
SELECT
uq.ID, uq.Question, uq.UserID, uq.Date
FROM user_questions AS uq
WHERE uq.ID NOT IN
(SELECT sq.QuestionID FROM staff_answers AS sq WHERE sq.UserID = '$LoggedUser[ID]')
ORDER BY uq.Date DESC");
$Questions = $DB->to_array();
$DB->query("SELECT COUNT(1) FROM user_questions");
list($TotalQuestions) = $DB->next_record();
View::show_header("Ask the Staff", "questions");
?>
<div class="thin">
<h2>
User Questions
<span style="float: right;">
<?=$TotalQuestions?> questions asked, <?=count($Questions)?> left to answer
</span>
</h2>
<div class="linkbox">
<a class="brackets" href="questions.php?action=answers">View staff answers</a>
</div>
<? foreach($Questions as $Question) { ?>
<div id="question<?=$Question['ID']?>" class="box box2">
<div class="head">
<span>
<a class="post_id" href="questions.php#question<?=$Question['ID']?>">#<?=$Question['ID']?></a>
<?=Users::format_username($Question['UserID'])?> - <?=time_diff($Question['Date'])?>
</span>
<span style="float: right;">
<form class="hidden" id="delete_<?=$Question['ID']?>" method="POST">
<input type="hidden" name="action" value="take_remove_question" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
</form>
<a href="#" onclick="$('#delete_<?=$Question['ID']?>').raw().submit(); return false;" class="brackets">Delete</a>
-
<a href="#" id="<?=$Question['ID']?>" class="answer_link brackets">Answer</a>
</span>
</div>
<div class="pad">
<?=$Text->full_format($Question['Question'])?>
</div>
</div>
<div id="answer<?=$Question['ID']?>" class="hidden center box pad">
<textarea id="replybox_<?=$Question['ID']?>" class="required" onkeyup="resize('replybox_<?=$Question['ID']?>');" name="answer" cols="90" rows="8"></textarea>
<div id="buttons" class="center">
<input type="submit" class="submit submit_button" id="<?=$Question['ID']?>" value="Answer" />
</div>
</div>
<? } ?>
</div>
<?
View::show_footer();

View File

@ -0,0 +1,38 @@
<?
authorize();
if (!check_perms("users_mod")) {
error(403);
}
$ID = $_POST['id'];
$Answer = db_string($_POST['answer']);
$Date = sqltime();
$UserID = $LoggedUser['ID'];
if (!is_number($ID) || empty($Answer)) {
error(404);
}
$DB->query("SELECT 1 FROM staff_answers WHERE QuestionID = '$ID' AND UserID = '$LoggedUser[ID]'");
if (!$DB->has_results()) {
$DB->query("
INSERT INTO staff_answers
(QuestionID, UserID, Answer, Date)
VALUES
('$ID', '$UserID', '$Answer', '$Date')");
$DB->query("SELECT UserID FROM user_questions WHERE ID = '$ID'");
list($ToID) = $DB->next_record();
Misc::send_pm($ToID, 0, "Your question has been answered", "One of your questions has been answered! View the response [url=https://". SSL_SITE_URL . "/questions.php?action=view_answers&userid=$UserID#question$ID]here[/url].");
} else {
error("You have already answered this question");
}
header("Location: questions.php");

View File

@ -0,0 +1,20 @@
<?
authorize();
$Question = db_string($_POST['question']);
if (empty($Question)) {
error("No question asked");
}
$UserID = $LoggedUser['ID'];
$Date = sqltime();
$DB->query("
INSERT INTO user_questions
(Question, UserID, Date)
VALUES
('$Question', '$UserID', '$Date')");
header("Location: questions.php");

View File

@ -0,0 +1,16 @@
<?
authorize();
if (!check_perms("users_mod")) {
error(404);
}
$ID = $_POST['question_id'];
if (!is_number($ID)) {
error(404);
}
G::$DB->query("DELETE FROM staff_answers WHERE QuestionID = '$ID' AND UserID = '$LoggedUser[ID]'");
header("Location: questions.php");

View File

@ -0,0 +1,16 @@
<?
authorize();
if (!check_perms("users_mod")) {
error(404);
}
$ID = $_POST['question_id'];
if (!is_number($ID)) {
error(404);
}
G::$DB->query("DELETE FROM user_questions WHERE ID = '$ID'");
header("Location: questions.php");

View File

@ -0,0 +1,65 @@
<?
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT(true);
$UserID = $_GET['userid'];
if (!is_number($UserID)) {
error("No UserID");
}
$UserInfo = Users::user_info($UserID);
G::$DB->query("
SELECT
u.Username, q.ID, q.Question, q.UserID, q.Date AS QuestionDate, a.Answer, a.Date AS AnswerDate
FROM user_questions AS q
JOIN staff_answers AS a ON q.ID = a.QuestionID
JOIN users_main AS u ON u.ID = q.UserID
WHERE a.UserID = '$UserID'
ORDER BY q.Date DESC");
$Questions = G::$DB->to_array();
View::show_header($UserInfo['Username'] . "'s answers");
?>
<div class="thin">
<h2>
<?=$UserInfo['Username']?>'s Answers
</h2>
<div class="linkbox">
<? if (check_perms("users_mod")) { ?>
<a class="brackets" href="questions.php">View questions</a>
<? } else { ?>
<a class="brackets" href="questions.php">Ask question</a>
<? } ?>
<a class="brackets" href="questions.php?action=answers">View staff answers</a>
</div>
<? foreach($Questions as $Question) { ?>
<div id="question<?=$Question['ID']?>" class="forum_post box box2">
<div class="head">
<span>
<a class="post_id" href="questions.php?action=view_answers&amp;userid=<?=$UserID?>#question<?=$Question['ID']?>">#<?=$Question['ID']?></a>
Question by <?=Users::format_username($Question['UserID'])?> - <?=time_diff($Question['QuestionDate'])?>
</span>
<? if (check_perms("users_mod")) { ?>
<span style="float: right;">
<form class="hidden" id="delete_<?=$Question['ID']?>" method="POST">
<input type="hidden" name="action" value="take_remove_answer" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
</form>
<a href="#" onclick="$('#delete_<?=$Question['ID']?>').raw().submit(); return false;" class="brackets">Delete</a>
</span>
<? } ?>
</div>
<div class="pad">
<?=$Text->full_format("[quote=" . $Question['Username'] . "]". $Question['Question'] . "[/quote]" . "\n". $Question['Answer'])?>
</div>
</div>
<? } ?>
</div>
<?
View::show_footer();

View File

@ -10,7 +10,10 @@
WHERE ID = $ConvID");
list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status) = $DB->next_record();
if (!(($UserID == $LoggedUser['ID']) || ($AssignedToUser == $LoggedUser['ID']) || (($Level > 0 && $Level <= $LoggedUser['EffectiveClass']) || ($Level == 0 && $IsFLS)))) {
if (!(($UserID == $LoggedUser['ID'])
|| ($AssignedToUser == $LoggedUser['ID'])
|| (($Level > 0 && $Level <= $LoggedUser['EffectiveClass']) || ($Level == 0 && $IsFLS))
)) {
// User is trying to view someone else's conversation
error(403);
}
@ -93,7 +96,7 @@
</strong>
<?=time_diff($SentDate, 2, true)?>
<? if ($Status != 'Resolved') { ?>
- <a href="#quickpost" onclick="Quote('<?=$MessageID?>','<?=$Username?>');" class="brackets">Quote</a>
- <a href="#quickpost" onclick="Quote('<?=$MessageID?>', '<?=$Username?>');" class="brackets">Quote</a>
<? } ?>
</div>
<div class="body"><?=$Text->full_format($Message)?></div>
@ -128,15 +131,18 @@
<? } ?>
</select>
<input type="button" value="Set message" onclick="SetMessage();" />
<input type="button" value="Create new / Edit" onclick="location.href='staffpm.php?action=responses&amp;convid=<?=$ConvID?>'" />
<input type="button" value="Create new / Edit" onclick="location.href='staffpm.php?action=responses&amp;convid=<?=$ConvID?>';" />
</div>
</div>
<? }
<?
}
// Ajax assign response div
if ($IsStaff) { ?>
if ($IsStaff) {
?>
<div id="ajax_message" class="hidden center alertbar"></div>
<? }
<?
}
// Reply box and buttons
?>
@ -168,8 +174,10 @@
$Selected = ((!$AssignedToUser && ($Level == $Class['Level'])) ? ' selected="selected"' : '');
?>
<option value="class_<?=$Class['Level']?>"<?=$Selected?>><?=$Class['Name']?></option>
<? }
} ?>
<?
}
}
?>
</optgroup>
<optgroup label="Staff">
<? // Staff members
@ -215,18 +223,20 @@
<? } elseif ($IsFLS) { // FLS assign button ?>
<input type="button" value="Assign to staff" onclick="location.href='staffpm.php?action=assign&amp;to=staff&amp;convid=<?=$ConvID?>';" />
<input type="button" value="Assign to forum staff" onclick="location.href='staffpm.php?action=assign&amp;to=forum&amp;convid=<?=$ConvID?>';" />
<? }
<?
}
if ($Status != 'Resolved') { ?>
<input type="button" value="Resolve" onclick="location.href='staffpm.php?action=resolve&amp;id=<?=$ConvID?>';" />
<? if ($IsFLS) { //Moved by request ?>
<? if ($IsFLS) { //Moved by request ?>
<input type="button" value="Common answers" onclick="$('#common_answers').gtoggle();" />
<? } ?>
<? } ?>
<input type="button" id="previewbtn" value="Preview" class="hidden button_preview_<?=$TextPrev->getID()?>" title="Preview text" />
<input type="submit" value="Send message" />
<? } else { ?>
<input type="button" value="Unresolve" onclick="location.href='staffpm.php?action=unresolve&amp;id=<?=$ConvID?>';" />
<? }
<input type="button" value="Unresolve" onclick="location.href='staffpm.php?action=unresolve&amp;id=<?=$ConvID?>';" />
<?
}
if (check_perms('users_give_donor')) { ?>
<br />
<input type="button" value="Make Donor" onclick="$('#make_donor_form').gtoggle(); return false;" />
@ -234,12 +244,12 @@
</form>
<? if (check_perms('users_give_donor')) { ?>
<div id="make_donor_form" class="hidden">
<form action="staffpm.php" method="POST">
<form action="staffpm.php" method="post">
<input type="hidden" name="action" value="make_donor" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ConvID?>" />
<strong>Amount: </strong>
<input type="text" name="donation_amount" onkeypress="return isNumberKey(event)" />
<input type="text" name="donation_amount" onkeypress="return isNumberKey(event);" />
<br />
<strong>Reason: </strong>
<input type="text" name="donation_reason" />
@ -250,7 +260,7 @@
<select name="donation_currency">
<option value="EUR">EUR</option>
</select>
<input type="submit" value="Submit"/>
<input type="submit" value="Submit" />
</form>
</div>
<? } ?>

View File

@ -48,7 +48,7 @@
</div>
</div>
<form action="" method="GET">
<form action="" method="get">
<input type="hidden" name="action" value="donor_rewards" />
<strong>Username Search: </strong><input type="text" name="username" />
</form>
@ -69,40 +69,32 @@
foreach ($Users as $User) {
$UserInfo = Users::user_info($User['UserID']);
$Username = $UserInfo['Username'];
?>
?>
<tr class="row<?=$Row?>">
<td>
<?=Users::format_username($User['UserID'], false, true, true, false, false, true)?>
</td>
<td>
<?=$User['Rank']?>
</td>
<td>
<?=$User['Hidden'] ? "Yes" : "No"?>
</td>
<td>
<?=time_diff($User['DonationTime'])?>
</td>
<td style="word-wrap: break-word">
<td><?=Users::format_username($User['UserID'], false, true, true, false, false, true)?></td>
<td><?=$User['Rank']?></td>
<td><?=$User['Hidden'] ? "Yes" : "No"?></td>
<td><?=time_diff($User['DonationTime'])?></td>
<td style="word-wrap: break-word;">
<?=$User['IconMouseOverText']?>
</td>
<td style="word-wrap: break-word">
<? if (!empty($User['CustomIcon'])) { ?>
<img src="<?=ImageTools::process($User['CustomIcon'])?>" width="15" height="13" />
<? } ?>
<td style="word-wrap: break-word;">
<? if (!empty($User['CustomIcon'])) { ?>
<img src="<?=ImageTools::process($User['CustomIcon'])?>" width="15" height="13" alt="" />
<? } ?>
</td
> <td style="word-wrap: break-word">
> <td style="word-wrap: break-word;">
<?=$User['CustomIconLink']?>
</td>
<td style="word-wrap: break-word">
<td style="word-wrap: break-word;">
<?=$User['AvatarMouseOverText']?>
</td>
<td style="word-wrap: break-word">
<td style="word-wrap: break-word;">
<?=$User['SecondAvatar']?>
</td>
</tr>
<?
$Row = $Row == 'b' ? 'a' : 'b';
$Row = $Row === 'b' ? 'a' : 'b';
} // foreach
?>
</table>

View File

@ -495,6 +495,7 @@
case 'take_mass_pm':
include(SERVER_ROOT.'/sections/tools/managers/take_mass_pm.php');
break;
default:
include(SERVER_ROOT.'/sections/tools/tools.php');
}

View File

@ -10,19 +10,19 @@
$Year = $_GET['year'];
$Month = $_GET['month'];
$Day = $_GET['day'];
if (10 > $Month) {
$Month = "0" . $Month;
if ($Month < 10) {
$Month = "0$Month";
}
if (10 > $Day) {
$Day = "0" . $Day;
if ($Day < 10) {
$Day = "0$Day";
}
$StartDate = $EndDate = $Year . "-" . $Month . "-" . $Day;
$StartDate = $EndDate = "$Year-$Month-$Day";
}
?>
<form id="event_form" name="event_form" method="POST">
<form id="event_form" name="event_form" method="post" action="">
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<? if ($Event) { ?>
<input type="hidden" name="id" value="<?=$Event['ID']?>" />
<input type="hidden" name="id" value="<?=$Event['ID']?>" />
<? } ?>
<input type="hidden" name="action" value="take_calendar_event" />
<table class="event_form_table">
@ -30,17 +30,19 @@
<tr>
<td class="label">Title:</td>
<td>
<input type="text" id="title" name="title" class="required" value="<?=$Event['Title']?>" >
<input type="text" id="title" name="title" class="required" value="<?=$Event['Title']?>" />
</td>
</tr>
<tr>
<td class="label">Category:</td>
<td>
<select id="category" name="category" class="required">
<? $Categories = Calendar::$Categories;
foreach ($Categories as $Key => $Value) { ?>
<option value="<?=$Key?>" <?=$Key == $Event['Category'] ? "selected='selected'" : ""?>><?=$Value?></option>
<? } ?>
<?
$Categories = Calendar::$Categories;
foreach ($Categories as $Key => $Value) {
?>
<option value="<?=$Key?>"<?=$Key == $Event['Category'] ? ' selected="selected"' : ''?>><?=$Value?></option>
<? } ?>
</select>
</td>
</tr>
@ -48,10 +50,12 @@
<td class="label">Importance:</td>
<td>
<select id="importance" name="importance" class="required">
<? $Importances = Calendar::$Importances;
foreach ($Importances as $Key => $Value) { ?>
<option value="<?=$Key?>" <?=$Key == $Event['Importance'] ? "selected='selected'" : ""?>><?=$Value?></option>
<? } ?>
<?
$Importances = Calendar::$Importances;
foreach ($Importances as $Key => $Value) {
?>
<option value="<?=$Key?>"<?=$Key == $Event['Importance'] ? ' selected="selected"' : ''?>><?=$Value?></option>
<? } ?>
</select>
</td>
</tr>
@ -59,33 +63,35 @@
<td class="label">Team:</td>
<td>
<select id="team" name="team" class="required">
<? $Teams = Calendar::$Teams;
foreach ($Teams as $Key => $Value) { ?>
<option value="<?=$Key?>" <?=$Key == $Event['Team'] ? "selected='selected'" : ""?>><?=$Value?></option>
<? } ?>
<?
$Teams = Calendar::$Teams;
foreach ($Teams as $Key => $Value) {
?>
<option value="<?=$Key?>"<?=$Key == $Event['Team'] ? ' selected="selected"' : ''?>><?=$Value?></option>
<? } ?>
</select>
</td>
</tr>
<tr>
<td class="label">Start Date:</td>
<td class="label">Start date:</td>
<td>
<input type="date" id="start_date" name="start_date" class="required"
<? if ($Event) { ?>
value="<?=date('Y-m-d', strtotime($Event['StartDate']))?>"
<? } else { ?>
value="<?=$StartDate?>"/>
<? } ?>
<? if ($Event) { ?>
value="<?=date('Y-m-d', strtotime($Event['StartDate']))?>" />
<? } else { ?>
value="<?=$StartDate?>" />
<? } ?>
</td>
</tr>
<tr>
<td class="label">End Date:</td>
<td class="label">End date:</td>
<td>
<input type="date" id="end_date" name="end_date" class="required"
<? if ($Event) { ?>
value="<?=date('Y-m-d', strtotime($Event['EndDate']))?>"
<? } else { ?>
value="<?=$EndDate?>"/>
<? } ?>
<? if ($Event) { ?>
value="<?=date('Y-m-d', strtotime($Event['EndDate']))?>" />
<? } else { ?>
value="<?=$EndDate?>" />
<? } ?>
</td>
</tr>
<tr>
@ -100,20 +106,24 @@
</td>
</tr>
<tr>
<? if (check_perms("users_mod")) {
if ($Event) { ?>
<td>
<input type="submit" id="update" name="update" value="Update">
</td>
<td>
<input type="submit" id="delete" name="delete" value="Delete">
</td>
<? } else { ?>
<td>
<input type="submit" id="create" name="create" value="Create">
</td>
<? }
} ?>
<?
if (check_perms('users_mod')) {
if ($Event) {
?>
<td>
<input type="submit" id="update" name="update" value="Update" />
</td>
<td>
<input type="submit" id="delete" name="delete" value="Delete" />
</td>
<? } else { ?>
<td>
<input type="submit" id="create" name="create" value="Create" />
</td>
<?
}
}
?>
</tr>
</tr>
</table>

View File

@ -48,21 +48,23 @@
echo "\t\t$Pages\n";
?>
</div>
<? if ($CanEdit) { ?>
<? if ($CanEdit) { ?>
<div class="box box2 edit_changelog">
<div class="head">
<strong>Manually submit a new change to the change log</strong>
</div>
<div class="pad">
<form method="post">
<form method="post" action="">
<input type="hidden" name="perform" value="add" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<div class="field_div" id="cl_message">
<span class="label">Commit message:</span><br />
<textarea name="message" /></textarea>
<span class="label">Commit message:</span>
<br />
<textarea name="message" rows="2"></textarea>
</div>
<div class="field_div" id="cl_author">
<span class="label">Author:</span><br />
<span class="label">Author:</span>
<br />
<input type="text" name="author" value="<?=$LoggedUser['Username']?>" />
</div>
<div class="submit_div" id="cl_submit">
@ -71,27 +73,29 @@
</form>
</div>
</div>
<? }
<?
}
foreach ($ChangeLog as $Change) { ?>
foreach ($ChangeLog as $Change) {
?>
<div class="box box2">
<div class="head">
<span><?=$Change['Time']?> by <?=$Change['Author']?></span>
<? if ($CanEdit) { ?>
<span style="float: right;">
<form id="delete_<?=$Change['ID']?>" method="POST">
<input type="hidden" name="perform" value="remove" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="change_id" value="<?=$Change['ID']?>" />
</form>
<? if ($CanEdit) { ?>
<span style="float: right;">
<form id="delete_<?=$Change['ID']?>" method="post" action="">
<input type="hidden" name="perform" value="remove" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="change_id" value="<?=$Change['ID']?>" />
</form>
<a href="#" onclick="$('#delete_<?=$Change['ID']?>').raw().submit(); return false;" class="brackets">Delete</a>
</span>
<? } ?>
</span>
<? } ?>
</div>
<div class="pad">
<?=$Change['Message']?>
</div>
</div>
<? } ?>
<? } ?>
</div>
<? View::show_footer(); ?>

View File

@ -40,18 +40,18 @@
<h2>Email Blacklist</h2>
</div>
<br />
<form action="tools.php" method="POST">
<form action="tools.php" method="post">
<input type="hidden" name="action" value="email_blacklist" />
<input type="text" name="email" size="30" placeholder="Email"/>
<input type="text" name="comment" size="60" placeholder="Comment"/>
<input type="text" name="email" size="30" placeholder="Email" />
<input type="text" name="comment" size="60" placeholder="Comment" />
<input type="submit" value="Search" />
</form>
<div class="linkbox pager">
<br />
<?
<?
$Pages = Format::get_pages($Page, $NumResults, TOPICS_PER_PAGE, 9);
echo $Pages;
?>
?>
</div>
<table>
<tr class="colhead">
@ -73,9 +73,8 @@
</form>
</tr>
<?
foreach ($Results as $Result) {
?>
?>
<tr>
<form class="manage_form" name="email_blacklist" action="tools.php" method="post">
<td>

View File

@ -14,9 +14,9 @@
<h2>Set global notification</h2>
<div class="thin box pad">
<form action="tools.php" method="POST">
<input type="hidden" name="action" value="take_global_notification">
<input type="hidden" name="type" value="set">
<form action="tools.php" method="post">
<input type="hidden" name="action" value="take_global_notification" />
<input type="hidden" name="type" value="set" />
<table align="center">
<tr>
<td class="label">Message</td>
@ -34,31 +34,31 @@
<td class="label">Importance</td>
<td>
<select name="importance" id="importance">
<? foreach (NotificationsManager::$Importances as $Key => $Value) { ?>
<option value="<?=$Value?>" <?=$Value == $GlobalNotification['Importance'] ? "selected='selected'" : ""?>><?=ucfirst($Key)?></option>
<? } ?>
<? foreach (NotificationsManager::$Importances as $Key => $Value) { ?>
<option value="<?=$Value?>"<?=$Value == $GlobalNotification['Importance'] ? ' selected="selected"' : ''?>><?=ucfirst($Key)?></option>
<? } ?>
</select>
</td>
</tr>
<tr>
<td class="label">Length (in minutes)</td>
<td>
<input type="text" name="length" id="length" size="20" value="<?=$Expiration?>"/>
<input type="text" name="length" id="length" size="20" value="<?=$Expiration?>" />
</td>
</tr>
<tr>
<td>
<input type="submit" name="set" value="Create Notification" />
</td>
<? if ($GlobalNotification) { ?>
<td>
<input type="submit" name="delete" value="Delete Notification" />
</td>
<? } ?>
<? if ($GlobalNotification) { ?>
<td>
<input type="submit" name="delete" value="Delete Notification" />
</td>
<? } ?>
</tr>
</table>
</form>
</div>
<?
View::show_footer();
View::show_footer();

View File

@ -70,7 +70,7 @@
</tr>
<tr />
<tr>
<form method="post">
<form method="post" action="">
<input type="hidden" name="newalias" value="1" />
<td>
<input type="text" name="AliasLabel" />
@ -90,9 +90,9 @@
$LabelNameSQL
ORDER BY $OrderBy");
while (list($ID, $BadLabel, $AliasLabel) = $DB->next_record()) {
?>
?>
<tr>
<form method="post">
<form method="post" action="">
<input type="hidden" name="changealias" value="1" />
<input type="hidden" name="aliasid" value="<?=$ID?>" />
<td>
@ -108,6 +108,7 @@
</form>
</tr>
<?
} ?>
}
?>
</table>
<? View::show_footer(); ?>

View File

@ -9,7 +9,7 @@ function display_perm($Key, $Title) {
echo "$Perm\n";
}
View::show_header('Manage Permissions','validate');
View::show_header('Manage Permissions', 'validate');
echo $Val->GenerateJS('permissionsform');
?>
@ -24,19 +24,19 @@ function display_perm($Key, $Title) {
<table class="permission_head layout">
<tr>
<td class="label">Permission name</td>
<td><input type="text" name="name" id="name" value="<?=(!empty($Name) ? display_str($Name) : '')?>" /></td>
<td><input type="text" name="name" id="name" value="<?=!empty($Name) ? display_str($Name) : ''?>" /></td>
</tr>
<tr>
<td class="label">Class level</td>
<td><input type="text" name="level" id="level" value="<?=(!empty($Level) ? display_str($Level) : '')?>" /></td>
<td><input type="text" name="level" id="level" value="<?=!empty($Level) ? display_str($Level) : ''?>" /></td>
</tr>
<tr>
<td class="label">Secondary class</td>
<td><input type="checkbox" name="secondary" value="1"<? if (!empty($Secondary)) { ?> checked="checked"<? } ?> /></td>
<td><input type="checkbox" name="secondary" value="1"<?=!empty($Secondary) ? ' checked="checked"' : ''?> /></td>
</tr>
<tr>
<td class="label">Show on staff page</td>
<td><input type="checkbox" name="displaystaff" value="1"<? if (!empty($DisplayStaff)) { ?> checked="checked"<? } ?> /></td>
<td><input type="checkbox" name="displaystaff" value="1"<?=!empty($DisplayStaff) ? ' checked="checked"' : ''?> /></td>
</tr>
<tr>
<td class="label">Maximum number of personal collages</td>

View File

@ -416,33 +416,33 @@ function check_paranoia_here($Setting) {
list($EmailChanges) = $DB->next_record();
}
?>
<div class="box box_info box_userinfo_history">
<div class="head colhead_dark">History</div>
<ul class="stats nobullet">
<div class="box box_info box_userinfo_history">
<div class="head colhead_dark">History</div>
<ul class="stats nobullet">
<? if (check_perms('users_view_email', $Class)) { ?>
<li>Emails: <?=number_format($EmailChanges)?> <a href="userhistory.php?action=email2&amp;userid=<?=$UserID?>" class="brackets">View</a>&nbsp;<a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" class="brackets">Legacy view</a></li>
<li>Emails: <?=number_format($EmailChanges)?> <a href="userhistory.php?action=email2&amp;userid=<?=$UserID?>" class="brackets">View</a>&nbsp;<a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" class="brackets">Legacy view</a></li>
<?
}
if (check_perms('users_view_ips', $Class)) {
?>
<li>IPs: <?=number_format($IPChanges)?> <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" class="brackets">View</a>&nbsp;<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1" class="brackets">View users</a></li>
<li>IPs: <?=number_format($IPChanges)?> <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" class="brackets">View</a>&nbsp;<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1" class="brackets">View users</a></li>
<? if (check_perms('users_view_ips', $Class) && check_perms('users_mod', $Class)) { ?>
<li>Tracker IPs: <?=number_format($TrackerIPs)?> <a href="userhistory.php?action=tracker_ips&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Tracker IPs: <?=number_format($TrackerIPs)?> <a href="userhistory.php?action=tracker_ips&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<?
}
}
if (check_perms('users_view_keys', $Class)) {
?>
<li>Passkeys: <?=number_format($PasskeyChanges)?> <a href="userhistory.php?action=passkeys&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Passkeys: <?=number_format($PasskeyChanges)?> <a href="userhistory.php?action=passkeys&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<?
}
if (check_perms('users_mod', $Class)) {
?>
<li>Passwords: <?=number_format($PasswordChanges)?> <a href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Stats: N/A <a href="userhistory.php?action=stats&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Passwords: <?=number_format($PasswordChanges)?> <a href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Stats: N/A <a href="userhistory.php?action=stats&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<? } ?>
</ul>
</div>
</ul>
</div>
<? } ?>
<div class="box box_info box_userinfo_personal">
<div class="head colhead_dark">Personal</div>
@ -529,8 +529,8 @@ function check_paranoia_here($Setting) {
list($SupportFor) = $DB->next_record();
}
if ($Override = check_perms('users_mod') || $OwnProfile || !empty($SupportFor)) {
?>
<li<?=(($Override === 2 || $SupportFor) ? ' class="paranoia_override"' : '')?>>Clients: <?
?>
<li<?=(($Override === 2 || $SupportFor) ? ' class="paranoia_override"' : '')?>>Clients: <?
$DB->query("
SELECT DISTINCT useragent
FROM xbt_files_users
@ -576,7 +576,7 @@ function check_paranoia_here($Setting) {
?>
</div>
</div>
<? DonationsView::render_profile_rewards($EnabledRewards, $ProfileRewards); ?>
<? DonationsView::render_profile_rewards($EnabledRewards, $ProfileRewards); ?>
<?
if (check_paranoia_here('snatched')) {
$RecentSnatches = $Cache->get_value("recent_snatches_$UserID");
@ -742,7 +742,7 @@ function check_paranoia_here($Setting) {
<a href="#invitetree_box" class="brackets anchor">#</a> Invite Tree <a href="#" onclick="$('#invitetree').gtoggle(); return false;" class="brackets">View</a>
</div>
<div id="invitetree" class="hidden">
<? $Tree->make_tree(); ?>
<? $Tree->make_tree(); ?>
</div>
</div>
<?

View File

@ -0,0 +1,24 @@
$(document).ready(function() {
$(".answer_link").click(function(e) {
e.preventDefault();
id = this.id;
$("#answer" + id).gtoggle();
});
$(".submit_button").click(function(e) {
id = this.id;
$.ajax({
type : "POST",
url : "questions.php?action=take_answer_question",
data : {
"auth" : authkey,
"id" : id,
"answer" : $("#replybox_" + id).val()
}
}).done(function() {
$("#question" + id).remove();
$("#answer" + id).remove();
});
});
});