mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-31 02:21:36 +00:00
Empty commit
This commit is contained in:
parent
ba33634e19
commit
271dfafde4
@ -10,7 +10,9 @@
|
||||
|
||||
$SSL = ($_SERVER['SERVER_PORT'] === '443');
|
||||
|
||||
if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); }
|
||||
if (isset($_COOKIE['session'])) {
|
||||
$LoginCookie = $Enc->decrypt($_COOKIE['session']);
|
||||
}
|
||||
if (isset($LoginCookie)) {
|
||||
list($SessionID, $UserID) = explode("|~|",$Enc->decrypt($LoginCookie));
|
||||
|
||||
@ -34,15 +36,17 @@ function error($Error) {
|
||||
}
|
||||
|
||||
function is_number($Str) {
|
||||
if ($Str < 0) { return false; }
|
||||
if ($Str < 0) {
|
||||
return false;
|
||||
}
|
||||
// We're converting input to a int, then string and comparing to original
|
||||
return ($Str == strval(intval($Str)) ? true : false);
|
||||
}
|
||||
|
||||
function display_str($Str) {
|
||||
if ($Str!="") {
|
||||
if ($Str != '') {
|
||||
$Str = make_utf8($Str);
|
||||
$Str=mb_convert_encoding($Str,"HTML-ENTITIES","UTF-8");
|
||||
$Str = mb_convert_encoding($Str,'HTML-ENTITIES','UTF-8');
|
||||
$Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m","&",$Str);
|
||||
|
||||
$Replace = array(
|
||||
@ -61,12 +65,21 @@ function display_str($Str) {
|
||||
}
|
||||
|
||||
function make_utf8($Str) {
|
||||
if ($Str!="") {
|
||||
if (is_utf8($Str)) { $Encoding="UTF-8"; }
|
||||
if (empty($Encoding)) { $Encoding=mb_detect_encoding($Str,'UTF-8, ISO-8859-1'); }
|
||||
if (empty($Encoding)) { $Encoding="ISO-8859-1"; }
|
||||
if ($Encoding=="UTF-8") { return $Str; }
|
||||
else { return @mb_convert_encoding($Str,"UTF-8",$Encoding); }
|
||||
if ($Str != '') {
|
||||
if (is_utf8($Str)) {
|
||||
$Encoding = 'UTF-8';
|
||||
}
|
||||
if (empty($Encoding)) {
|
||||
$Encoding = mb_detect_encoding($Str,'UTF-8, ISO-8859-1');
|
||||
}
|
||||
if (empty($Encoding)) {
|
||||
$Encoding = 'ISO-8859-1';
|
||||
}
|
||||
if ($Encoding == 'UTF-8') {
|
||||
return $Str;
|
||||
} else {
|
||||
return @mb_convert_encoding($Str,'UTF-8',$Encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ function flush() {
|
||||
global $Cache, $DB;
|
||||
$DB->query("SELECT Alias, ArticleID FROM wiki_aliases");
|
||||
$Aliases = $DB->to_array('Alias');
|
||||
$Cache->cache_value('wiki_aliases', $Aliases, 3600*24*14);
|
||||
$Cache->cache_value('wiki_aliases', $Aliases, 3600 * 24 * 14); // 2 weeks
|
||||
}
|
||||
|
||||
function to_id($Alias) {
|
||||
@ -18,7 +18,7 @@ function to_id($Alias) {
|
||||
if (!$Aliases) {
|
||||
$DB->query("SELECT Alias, ArticleID FROM wiki_aliases");
|
||||
$Aliases = $DB->to_array('Alias');
|
||||
$Cache->cache_value('wiki_aliases', $Aliases, 3600*24*14);
|
||||
$Cache->cache_value('wiki_aliases', $Aliases, 3600 * 24 * 14); // 2 weeks
|
||||
}
|
||||
return $Aliases[$this->convert($Alias)]['ArticleID'];
|
||||
}
|
||||
@ -39,7 +39,8 @@ function article($ArticleID, $Error = true) {
|
||||
global $Cache, $DB;
|
||||
$Contents = $Cache->get_value('wiki_article_'.$ArticleID);
|
||||
if (!$Contents) {
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
w.Revision,
|
||||
w.Title,
|
||||
w.Body,
|
||||
@ -55,9 +56,11 @@ function article($ArticleID, $Error = true) {
|
||||
LEFT JOIN users_main AS u ON u.ID=w.Author
|
||||
WHERE w.ID='$ArticleID'
|
||||
GROUP BY w.ID");
|
||||
if(!$DB->record_count() && $Error) { error(404); }
|
||||
if (!$DB->record_count() && $Error) {
|
||||
error(404);
|
||||
}
|
||||
$Contents = $DB->to_array();
|
||||
$Cache->cache_value('wiki_article_'.$ArticleID, $Contents, 3600*24*14);
|
||||
$Cache->cache_value('wiki_article_'.$ArticleID, $Contents, 3600 * 24 * 14); // 2 weeks
|
||||
}
|
||||
return $Contents;
|
||||
}
|
||||
|
@ -78,7 +78,8 @@ function set_up(){
|
||||
}
|
||||
|
||||
// Get similarities between artists on the map
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
s1.ArtistID,
|
||||
s2.ArtistID
|
||||
FROM artists_similar AS s1
|
||||
@ -278,7 +279,7 @@ function set_positions(){
|
||||
function calculate_distance($SimilarityCoefficient, $Rootx, $Rooty) {
|
||||
$MaxWidth = WIDTH - $Rootx;
|
||||
$MaxHeight = HEIGHT - $Rooty;
|
||||
$x = $MaxWidth - ($SimilarityCoefficient*$MaxWidth*.01); // Possible x value
|
||||
$x = $MaxWidth - ($SimilarityCoefficient * $MaxWidth * 0.01); // Possible x value
|
||||
$y = $MaxHeight - ($SimilarityCoefficient * $MaxHeight); // Possible y value
|
||||
$Hypot = hypot($Rootx - $x, $Rooty - $y);
|
||||
return $MaxWidth - $Hypot;
|
||||
@ -307,8 +308,6 @@ function write_artists(){
|
||||
<?=$this->Name?>
|
||||
</div>
|
||||
<?
|
||||
|
||||
|
||||
foreach ($this->Artists as $Artist) {
|
||||
if ($Artist->ID == $this->ID) {
|
||||
continue;
|
||||
@ -362,7 +361,6 @@ function background_image(){
|
||||
}
|
||||
reset($this->xValues);
|
||||
}
|
||||
|
||||
$Img->make_png(SERVER_ROOT.'/static/similar/'.$this->ID.'.png');
|
||||
}
|
||||
|
||||
@ -381,9 +379,5 @@ function dump(){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -23,9 +23,9 @@ function channel($Title, $Description, $Section='') {
|
||||
}
|
||||
function item($Title, $Description, $Page, $Creator, $Comments='', $Category='', $Date='') { //Escape with CDATA, otherwise the feed breaks.
|
||||
if ($Date == '') {
|
||||
$Date = date("r");
|
||||
$Date = date('r');
|
||||
} else {
|
||||
$Date = date("r",strtotime($Date));
|
||||
$Date = date('r',strtotime($Date));
|
||||
}
|
||||
$Site = $this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.NONSSL_SITE_URL;
|
||||
$Item = "\t\t<item>\n";
|
||||
|
@ -54,7 +54,7 @@ function make_tree() {
|
||||
JOIN users_info AS ui ON ui.UserID=it.UserID
|
||||
WHERE TreeID=$TreeID
|
||||
AND TreePosition>$TreePosition".
|
||||
($MaxPosition ? " AND TreePosition<$MaxPosition" : "")."
|
||||
($MaxPosition ? " AND TreePosition<$MaxPosition" : '')."
|
||||
AND TreeLevel>$TreeLevel
|
||||
ORDER BY TreePosition");
|
||||
|
||||
@ -107,14 +107,18 @@ function make_tree() {
|
||||
|
||||
// Manage tree depth
|
||||
if ($TreeLevel > $PreviousTreeLevel) {
|
||||
for($i = 0; $i<$TreeLevel-$PreviousTreeLevel; $i++){ echo "<ul class=\"invitetree\"><li>"; }
|
||||
for ($i = 0; $i < $TreeLevel - $PreviousTreeLevel; $i++) {
|
||||
echo '<ul class="invitetree"><li>';
|
||||
}
|
||||
} elseif ($TreeLevel < $PreviousTreeLevel) {
|
||||
for($i = 0; $i<$PreviousTreeLevel-$TreeLevel; $i++){ echo "</li></ul>"; }
|
||||
echo "</li>";
|
||||
echo "<li>";
|
||||
for ($i = 0; $i < $PreviousTreeLevel - $TreeLevel; $i++) {
|
||||
echo '</li></ul>';
|
||||
}
|
||||
echo '</li>';
|
||||
echo '<li>';
|
||||
} else {
|
||||
echo "</li>";
|
||||
echo "<li>";
|
||||
echo '</li>';
|
||||
echo '<li>';
|
||||
}
|
||||
?>
|
||||
<strong><?=Users::format_username($ID, true, true, $Enabled != 2 ? false : true, true)?></strong>
|
||||
@ -140,7 +144,9 @@ function make_tree() {
|
||||
}
|
||||
|
||||
$Tree = ob_get_clean();
|
||||
for($i = 0; $i<$PreviousTreeLevel-$OriginalTreeLevel; $i++){ $Tree .= "</li></ul>\n"; }
|
||||
for ($i = 0; $i < $PreviousTreeLevel - $OriginalTreeLevel; $i++) {
|
||||
$Tree .= "</li></ul>\n";
|
||||
}
|
||||
|
||||
if ($Count) {
|
||||
|
||||
@ -150,10 +156,12 @@ function make_tree() {
|
||||
<?
|
||||
$ClassStrings = array();
|
||||
foreach ($ClassSummary as $ClassID => $ClassCount) {
|
||||
if($ClassCount == 0) { continue; }
|
||||
if ($ClassCount == 0) {
|
||||
continue;
|
||||
}
|
||||
$LastClass = Users::make_class_string($ClassID);
|
||||
if ($ClassCount > 1) {
|
||||
if($LastClass == "Torrent Celebrity") {
|
||||
if ($LastClass == 'Torrent Celebrity') {
|
||||
$LastClass = 'Torrent Celebrities';
|
||||
} else {
|
||||
$LastClass.='s';
|
||||
@ -174,14 +182,20 @@ function make_tree() {
|
||||
echo $DisabledCount;
|
||||
echo ($DisabledCount == 1) ? ' user is' : ' users are';
|
||||
echo ' disabled (';
|
||||
if($DisabledCount == 0) { echo '0%)'; }
|
||||
else { echo number_format(($DisabledCount/$Count)*100) . '%)';}
|
||||
if ($DisabledCount == 0) {
|
||||
echo '0%)';
|
||||
} else {
|
||||
echo number_format(($DisabledCount / $Count) * 100) . '%)';
|
||||
}
|
||||
echo ', and ';
|
||||
echo $DonorCount;
|
||||
echo ($DonorCount == 1) ? ' user has' : ' users have';
|
||||
echo ' donated (';
|
||||
if($DonorCount == 0) { echo '0%)'; }
|
||||
else { echo number_format(($DonorCount/$Count)*100) . '%)';}
|
||||
if ($DonorCount == 0) {
|
||||
echo '0%)';
|
||||
} else {
|
||||
echo number_format(($DonorCount / $Count) * 100) . '%)';
|
||||
}
|
||||
echo '. </p>';
|
||||
|
||||
echo '<p style="font-weight: bold;">';
|
||||
@ -196,7 +210,7 @@ function make_tree() {
|
||||
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 in to the invitation giving script.</p>';
|
||||
echo 'These numbers include the stats of paranoid users and will be factored into the invitation giving script.</p>';
|
||||
|
||||
if ($ParanoidCount) {
|
||||
echo '<p style="font-weight: bold;">';
|
||||
@ -211,7 +225,6 @@ function make_tree() {
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<br />
|
||||
<?=$Tree?>
|
||||
|
@ -202,7 +202,7 @@ protected function listen() {
|
||||
}
|
||||
}
|
||||
|
||||
if(preg_match("/End of message of the day./", $this->Data)) {
|
||||
if (preg_match('/End of message of the day./', $this->Data)) {
|
||||
$this->connect_events();
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,9 @@ private function valid_url ($Str, $Extension = '', $Inline = false) {
|
||||
|
||||
public function local_url ($Str) {
|
||||
$URLInfo = parse_url($Str);
|
||||
if (!$URLInfo) { return false; }
|
||||
if (!$URLInfo) {
|
||||
return false;
|
||||
}
|
||||
$Host = $URLInfo['host'];
|
||||
// If for some reason your site does not require subdomains or contains a directory in the SITE_URL, revert to the line below.
|
||||
//if ($Host == NONSSL_SITE_URL || $Host == SSL_SITE_URL || $Host == 'www.'.NONSSL_SITE_URL) {
|
||||
@ -512,7 +514,9 @@ public function parse_toc ($Min = 3)
|
||||
|
||||
foreach ($this->Headlines as $t) {
|
||||
$n = (int) $t[0];
|
||||
if ($i === 0 && $n > 1) $off = $n - $level;
|
||||
if ($i === 0 && $n > 1) {
|
||||
$off = $n - $level;
|
||||
}
|
||||
$this->headline_level($n, $level, $list, $i, $off);
|
||||
$list .= sprintf('<li><a href="#%2$s">%1$s</a>', $t[1], $t[2]);
|
||||
$level = $t[0];
|
||||
@ -565,7 +569,9 @@ private function headline_level (&$ItemLevel, &$Level, &$List, $i, &$Offset)
|
||||
private function to_html ($Array) {
|
||||
global $SSL;
|
||||
$this->Levels++;
|
||||
if ($this->Levels>10) { return $Block['Val']; } // Hax prevention
|
||||
if ($this->Levels > 10) {
|
||||
return $Block['Val'];
|
||||
} // Hax prevention
|
||||
$Str = '';
|
||||
|
||||
foreach ($Array as $Block) {
|
||||
@ -666,7 +672,9 @@ private function to_html ($Array) {
|
||||
$Str .= sprintf('%1$s%2$s%1$s', str_repeat('=', $Block['Attr'] + 1), $text);
|
||||
} else {
|
||||
$id = '_' . crc32($raw . $this->HeadlineID);
|
||||
if ($this->InQuotes === 0) $this->Headlines[] = array($Block['Attr'], $raw, $id);
|
||||
if ($this->InQuotes === 0) {
|
||||
$this->Headlines[] = array($Block['Attr'], $raw, $id);
|
||||
}
|
||||
|
||||
$Str .= sprintf('<h%1$d id="%3$s">%2$s</h%1$d>', ($Block['Attr'] + 2), $text, $id);
|
||||
$this->HeadlineID++;
|
||||
@ -685,7 +693,7 @@ private function to_html ($Array) {
|
||||
$this->NoImg++; // No images inside quote tags
|
||||
$this->InQuotes++;
|
||||
if (!empty($Block['Attr'])) {
|
||||
$Exploded = explode("|", $this->to_html($Block['Attr']));
|
||||
$Exploded = explode('|', $this->to_html($Block['Attr']));
|
||||
if (isset($Exploded[1]) && is_numeric($Exploded[1])) {
|
||||
$PostID = trim($Exploded[1]);
|
||||
$Str.='<a href="#" onclick="QuoteJump(event, '.$PostID.'); return false;"><strong class="quoteheader">'.$Exploded[0].'</strong> wrote: </a>';
|
||||
|
@ -231,10 +231,10 @@ function parse($Str) {
|
||||
|| (strpos($Attrib, "'") !== false)
|
||||
|| (strpos($Attrib, "\"") !== false)) {
|
||||
$IsTag = 0;
|
||||
} elseif (strpos($Attrib, "[") !== false) {
|
||||
} elseif (strpos($Attrib, '[') !== false) {
|
||||
// attributes aren't allowed to contain any tag (or something which looks like it might be one) inside them
|
||||
foreach ($this->ValidTags as $PossibleTag=>$_) {
|
||||
if (strpos($Attrib, "[".$PossibleTag) !== false) {
|
||||
if (strpos($Attrib, '['.$PossibleTag) !== false) {
|
||||
$IsTag = 0;
|
||||
}
|
||||
}
|
||||
@ -445,7 +445,9 @@ function parse($Str) {
|
||||
|
||||
function to_html($Array) {
|
||||
$this->Levels++;
|
||||
if($this->Levels>10) { return $Block['Val']; } // Hax prevention
|
||||
if ($this->Levels > 10) {
|
||||
return $Block['Val'];
|
||||
} // Hax prevention
|
||||
$Str = '';
|
||||
|
||||
foreach ($Array as $Block) {
|
||||
@ -577,7 +579,9 @@ function to_html($Array) {
|
||||
} else {
|
||||
$LocalURL = $this->local_url($Block['Attr']);
|
||||
if ($LocalURL) {
|
||||
if($NoName) { $Block['Val'] = substr($LocalURL,1); }
|
||||
if ($NoName) {
|
||||
$Block['Val'] = substr($LocalURL,1);
|
||||
}
|
||||
$Str.='<a href="'.$LocalURL.'">'.$Block['Val'].'</a>';
|
||||
} else {
|
||||
$Str.='<a rel="noreferrer" target="_blank" href="'.$Block['Attr'].'">'.$Block['Val'].'</a>';
|
||||
|
@ -121,7 +121,9 @@ function valid_url($Str, $Extension = '', $Inline = false) {
|
||||
|
||||
function local_url($Str) {
|
||||
$URLInfo = parse_url($Str);
|
||||
if(!$URLInfo) { return false; }
|
||||
if (!$URLInfo) {
|
||||
return false;
|
||||
}
|
||||
$Host = $URLInfo['host'];
|
||||
// If for some reason your site does not require subdomains or contains a directory in the SITE_URL, revert to the line below.
|
||||
//if ($Host == NONSSL_SITE_URL || $Host == SSL_SITE_URL || $Host == 'www.'.NONSSL_SITE_URL) {
|
||||
@ -538,7 +540,9 @@ function to_html($Array) {
|
||||
} else {
|
||||
$LocalURL = $this->local_url($Block['Attr']);
|
||||
if ($LocalURL) {
|
||||
if($NoName) { $Block['Val'] = substr($LocalURL,1); }
|
||||
if ($NoName) {
|
||||
$Block['Val'] = substr($LocalURL,1);
|
||||
}
|
||||
$Str.='<a href="'.$LocalURL.'">'.$Block['Val'].'</a>';
|
||||
} else {
|
||||
$Str.='<a rel="noreferrer" target="_blank" href="'.$Block['Attr'].'">'.$Block['Val'].'</a>';
|
||||
|
@ -154,7 +154,9 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
|
||||
if (!is_array($UserIDs)) {
|
||||
$UserIDs = array($UserIDs);
|
||||
}
|
||||
$DB->query("UPDATE users_info AS i JOIN users_main AS m ON m.ID=i.UserID
|
||||
$DB->query("
|
||||
UPDATE users_info AS i
|
||||
JOIN users_main AS m ON m.ID=i.UserID
|
||||
SET m.Enabled='2',
|
||||
m.can_leech='0',
|
||||
i.AdminComment = CONCAT('".sqltime()." - ".($AdminComment ? $AdminComment : 'Disabled by system')."\n\n', i.AdminComment),
|
||||
|
@ -658,7 +658,9 @@ function audiobook_form() {
|
||||
<?
|
||||
foreach (Misc::display_array($this->Formats) as $Format) {
|
||||
echo '<option value="'.$Format.'"';
|
||||
if ($Format == $Torrent['Format']) { echo ' selected="selected"'; }
|
||||
if ($Format == $Torrent['Format']) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>';
|
||||
echo $Format;
|
||||
echo "</option>\n";
|
||||
@ -675,7 +677,7 @@ function audiobook_form() {
|
||||
<?
|
||||
if (!$Torrent['Bitrate'] || ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates))) {
|
||||
$OtherBitrate = true;
|
||||
if (substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(" (VBR)")) == " (VBR)") {
|
||||
if (substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(' (VBR)')) == ' (VBR)') {
|
||||
$Torrent['Bitrate'] = substr($Torrent['Bitrate'], 0, strlen($Torrent['Bitrate']) - 6);
|
||||
$VBR = true;
|
||||
}
|
||||
@ -684,7 +686,7 @@ function audiobook_form() {
|
||||
}
|
||||
foreach (Misc::display_array($this->Bitrates) as $Bitrate) {
|
||||
echo '<option value="'.$Bitrate.'"';
|
||||
if ($Bitrate == $Torrent['Bitrate'] || ($OtherBitrate && $Bitrate == "Other")) {
|
||||
if ($Bitrate == $Torrent['Bitrate'] || ($OtherBitrate && $Bitrate == 'Other')) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>';
|
||||
|
@ -61,7 +61,9 @@ function table_query($TableName) {
|
||||
}
|
||||
|
||||
function get_rank($TableName, $Value) {
|
||||
if($Value == 0) { return 0; }
|
||||
if ($Value == 0) {
|
||||
return 0;
|
||||
}
|
||||
global $Cache, $DB;
|
||||
|
||||
$Table = $Cache->get_value(PREFIX.$TableName);
|
||||
@ -89,7 +91,9 @@ function get_rank($TableName, $Value) {
|
||||
|
||||
function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bounty, $Artists, $Ratio) {
|
||||
// We can do this all in 1 line, but it's easier to read this way
|
||||
if($Ratio>1) { $Ratio = 1; }
|
||||
if ($Ratio > 1) {
|
||||
$Ratio = 1;
|
||||
}
|
||||
$TotalScore = 0;
|
||||
if (in_array(false, func_get_args(), true)) {
|
||||
return false;
|
||||
|
@ -32,9 +32,7 @@
|
||||
$TorrentForm->simple_form($_GET['categoryid']);
|
||||
break;
|
||||
default:
|
||||
echo "Invalid action!";
|
||||
echo 'Invalid action!';
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -27,7 +27,9 @@
|
||||
case 'voted':
|
||||
if (!empty($_GET['userid'])) {
|
||||
if (is_number($_GET['userid'])) {
|
||||
if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { error(403); }
|
||||
if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) {
|
||||
error(403);
|
||||
}
|
||||
$Title = "Requests voted for by ".$UserInfo['Username'];
|
||||
$SS->set_filter('voter', array($_GET['userid']));
|
||||
} else {
|
||||
@ -42,7 +44,9 @@
|
||||
if (empty($_GET['userid']) || !is_number($_GET['userid'])) {
|
||||
error(404);
|
||||
} else {
|
||||
if (!check_paranoia('requestsfilled_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { error(403); }
|
||||
if (!check_paranoia('requestsfilled_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) {
|
||||
error(403);
|
||||
}
|
||||
$Title = "Requests filled by ".$UserInfo['Username'];
|
||||
$SS->set_filter('fillerid', array($_GET['userid']));
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
|
||||
?>
|
||||
<tr class="rowb">
|
||||
<td colspan="9" class="center">
|
||||
Found no torrents matching the criteria
|
||||
Found no torrents matching the criteria.
|
||||
</td>
|
||||
</tr>
|
||||
</table><br />
|
||||
|
@ -111,7 +111,16 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
|
||||
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID=t.ID
|
||||
WHERE t.GroupID='".db_string($GroupID)."'
|
||||
GROUP BY t.ID
|
||||
ORDER BY t.Remastered ASC, (t.RemasterYear <> 0) DESC, t.RemasterYear ASC, t.RemasterTitle ASC, t.RemasterRecordLabel ASC, t.RemasterCatalogueNumber ASC, t.Media ASC, t.Format, t.Encoding, t.ID");
|
||||
ORDER BY t.Remastered ASC,
|
||||
(t.RemasterYear <> 0) DESC,
|
||||
t.RemasterYear ASC,
|
||||
t.RemasterTitle ASC,
|
||||
t.RemasterRecordLabel ASC,
|
||||
t.RemasterCatalogueNumber ASC,
|
||||
t.Media ASC,
|
||||
t.Format,
|
||||
t.Encoding,
|
||||
t.ID");
|
||||
|
||||
$TorrentList = $DB->to_array('ID', MYSQLI_ASSOC);
|
||||
if (count($TorrentList) == 0) {
|
||||
@ -182,7 +191,9 @@ function get_reports($TorrentID){
|
||||
global $Cache, $DB;
|
||||
$Reports = $Cache->get_value('reports_torrent_' . $TorrentID);
|
||||
if ($Reports === false) {
|
||||
$DB->query("SELECT r.ID,
|
||||
$DB->query("
|
||||
SELECT
|
||||
r.ID,
|
||||
r.ReporterID,
|
||||
r.Type,
|
||||
r.UserComment,
|
||||
@ -234,7 +245,9 @@ function filelist($Str) {
|
||||
unset($ReportedTimes);
|
||||
$Reports = $Cache->get_value('reports_torrent_' . $TorrentID);
|
||||
if ($Reports === false) {
|
||||
$DB->query("SELECT r.ID,
|
||||
$DB->query("
|
||||
SELECT
|
||||
r.ID,
|
||||
r.ReporterID,
|
||||
r.Type,
|
||||
r.UserComment,
|
||||
@ -249,7 +262,7 @@ function filelist($Str) {
|
||||
if (count($Reports) > 0) {
|
||||
$Reported = true;
|
||||
include(SERVER_ROOT . '/sections/reportsv2/array.php');
|
||||
$ReportInfo = '<table><tr class="colhead_dark" style="font-weight: bold;"><td>This torrent has ' . count($Reports) . ' active ' . (count($Reports) > 1 ? "reports" : "report") . ':</td></tr>';
|
||||
$ReportInfo = '<table><tr class="colhead_dark" style="font-weight: bold;"><td>This torrent has ' . count($Reports) . ' active ' . (count($Reports) > 1 ? 'reports' : 'report') . ':</td></tr>';
|
||||
|
||||
foreach ($Reports as $Report) {
|
||||
list($ReportID, $ReporterID, $ReportType, $ReportReason, $ReportedTime) = $Report;
|
||||
@ -466,8 +479,7 @@ function filelist($Str) {
|
||||
<? }
|
||||
if (!empty($Description)) {
|
||||
echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>';
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
|
@ -101,7 +101,6 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
include(SERVER_ROOT.'/sections/torrents/delete_alias.php');
|
||||
break;
|
||||
|
||||
|
||||
case 'history':
|
||||
enforce_login();
|
||||
include(SERVER_ROOT.'/sections/torrents/history.php');
|
||||
@ -188,7 +187,9 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
}
|
||||
|
||||
$GroupID = $_POST['groupid'];
|
||||
if(!$GroupID) { error(404); }
|
||||
if (!$GroupID) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM torrents_comments AS tc WHERE tc.GroupID='".db_string($GroupID)."')/".TORRENT_COMMENTS_PER_PAGE.") AS Pages");
|
||||
list($Pages) = $DB->next_record();
|
||||
@ -217,7 +218,9 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
|
||||
case 'get_post':
|
||||
enforce_login();
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) { error(0); }
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||
error(0);
|
||||
}
|
||||
$DB->query("SELECT Body FROM torrents_comments WHERE ID='".db_string($_GET['post'])."'");
|
||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||
|
||||
@ -232,7 +235,9 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
$Text = new TEXT;
|
||||
|
||||
// Quick SQL injection check
|
||||
if(!$_POST['post'] || !is_number($_POST['post'])) { error(0); }
|
||||
if (!$_POST['post'] || !is_number($_POST['post'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
// Mainly
|
||||
$DB->query("SELECT
|
||||
@ -247,8 +252,12 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
$DB->query("SELECT ceil(COUNT(ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_POST[post]");
|
||||
list($Page) = $DB->next_record();
|
||||
|
||||
if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); }
|
||||
if ($DB->record_count()==0) { error(404); }
|
||||
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
|
||||
error(404);
|
||||
}
|
||||
if ($DB->record_count() == 0) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
// Perform the update
|
||||
$DB->query("UPDATE torrents_comments SET
|
||||
@ -284,10 +293,14 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
authorize();
|
||||
|
||||
// Quick SQL injection check
|
||||
if (!$_GET['postid'] || !is_number($_GET['postid'])) { error(0); }
|
||||
if (!$_GET['postid'] || !is_number($_GET['postid'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
// Make sure they are moderators
|
||||
if (!check_perms('site_moderate_forums')) { error(403); }
|
||||
if (!check_perms('site_moderate_forums')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
// Get topicid, forumid, number of pages
|
||||
$DB->query("SELECT
|
||||
|
@ -4,7 +4,9 @@
|
||||
$InviteKey = db_string($_GET['invite']);
|
||||
$DB->query("SELECT InviterID FROM invites WHERE InviteKey='$InviteKey'");
|
||||
list($UserID) = $DB->next_record();
|
||||
if($DB->record_count() == 0 || $UserID!=$LoggedUser['ID']){ error(404); }
|
||||
if ($DB->record_count() == 0 || $UserID!=$LoggedUser['ID']) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM invites WHERE InviteKey='$InviteKey'");
|
||||
|
||||
|
@ -24,7 +24,8 @@
|
||||
$Page = 10;
|
||||
$Limit = sprintf("%d, %d", ($Page - 1) * USERS_PER_PAGE, USERS_PER_PAGE);
|
||||
}
|
||||
$DB->query("SELECT SQL_CALC_FOUND_ROWS
|
||||
$DB->query("
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
ID,
|
||||
Username,
|
||||
Enabled,
|
||||
|
@ -208,7 +208,7 @@
|
||||
if (!empty($_POST['sorthide'])) {
|
||||
$JSON = json_decode($_POST['sorthide']);
|
||||
foreach ($JSON as $J) {
|
||||
$E = explode("_", $J);
|
||||
$E = explode('_', $J);
|
||||
$Options['SortHide'][$E[0]] = $E[1];
|
||||
}
|
||||
} else {
|
||||
@ -243,8 +243,7 @@
|
||||
$DB->query("UPDATE lastfm_users SET Username = '$LastFMUsername' WHERE ID = '$UserID'");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif(!empty($LastFMUsername)) {
|
||||
} elseif (!empty($LastFMUsername)) {
|
||||
$DB->query("INSERT INTO lastfm_users (ID, Username) VALUES ('$UserID', '$LastFMUsername')");
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
$LoggedUser['DisableInvites'] == '1'||
|
||||
$LoggedUser['Invites'] == 0 && !check_perms('site_send_unlimited_invites') ||
|
||||
($UserCount >= USER_LIMIT && USER_LIMIT != 0 && !check_perms('site_can_invite_always'))) {
|
||||
|
||||
error(403);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,16 @@
|
||||
<td><?=display_str($Values['IP'])?> (<?=display_str($Values['Code'])?>) <a href="user.php?action=search&ip_history=on&ip=<?=display_str($Values['IP'])?>" class="brackets" title="Search">S</a></td>
|
||||
<?
|
||||
if ($UsersOnly == 1) {
|
||||
$ueQuery = $DB->query("SELECT ue.UserID, Username, ue.Time, ue.IP FROM users_history_emails AS ue, users_main WHERE ue.Email = '".db_string($Values['Email'])."' AND UserID != ".$UserID." AND ID = UserID");
|
||||
$ueQuery = $DB->query("
|
||||
SELECT
|
||||
ue.UserID,
|
||||
Username,
|
||||
ue.Time,
|
||||
ue.IP
|
||||
FROM users_history_emails AS ue, users_main
|
||||
WHERE ue.Email = '".db_string($Values['Email'])."'
|
||||
AND UserID != ".$UserID."
|
||||
AND ID = UserID");
|
||||
while (list($UserID2, $Time, $IP) = $DB->next_record()) { ?>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -116,7 +125,6 @@
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
<? } ?>
|
||||
} ?>
|
||||
</table>
|
||||
<? View::show_footer(); ?>
|
||||
|
@ -13,9 +13,17 @@
|
||||
define('IPS_PER_PAGE', 25);
|
||||
|
||||
$UserID = $_GET['userid'];
|
||||
if (!is_number($UserID)) { error(404); }
|
||||
if (!is_number($UserID)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT um.Username, p.Level AS Class FROM users_main AS um LEFT JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = ".$UserID);
|
||||
$DB->query("
|
||||
SELECT
|
||||
um.Username,
|
||||
p.Level AS Class
|
||||
FROM users_main AS um
|
||||
LEFT JOIN permissions AS p ON p.ID=um.PermissionID
|
||||
WHERE um.ID = ".$UserID);
|
||||
list($Username, $Class) = $DB->next_record();
|
||||
|
||||
if (!check_perms('users_view_ips', $Class)) {
|
||||
@ -79,7 +87,8 @@ function UnBan(ip, id, elemID) {
|
||||
list($Page,$Limit) = Format::page_limit(IPS_PER_PAGE);
|
||||
|
||||
if ($UsersOnly == 1) {
|
||||
$RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS
|
||||
$RS = $DB->query("
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
h1.IP,
|
||||
h1.StartTime,
|
||||
h1.EndTime,
|
||||
@ -97,9 +106,11 @@ function UnBan(ip, id, elemID) {
|
||||
WHERE h1.UserID='$UserID'
|
||||
AND h2.UserID>0 $SearchIPQuery
|
||||
GROUP BY h1.IP, h1.StartTime
|
||||
ORDER BY h1.StartTime DESC LIMIT $Limit");
|
||||
ORDER BY h1.StartTime DESC
|
||||
LIMIT $Limit");
|
||||
} else {
|
||||
$RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS
|
||||
$RS = $DB->query("
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
h1.IP,
|
||||
h1.StartTime,
|
||||
h1.EndTime,
|
||||
@ -116,7 +127,8 @@ function UnBan(ip, id, elemID) {
|
||||
LEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID
|
||||
WHERE h1.UserID='$UserID' $SearchIPQuery
|
||||
GROUP BY h1.IP, h1.StartTime
|
||||
ORDER BY h1.StartTime DESC LIMIT $Limit");
|
||||
ORDER BY h1.StartTime DESC
|
||||
LIMIT $Limit");
|
||||
}
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($NumResults) = $DB->next_record();
|
||||
@ -169,7 +181,9 @@ function UnBan(ip, id, elemID) {
|
||||
|
||||
$HasDupe = false;
|
||||
$UserIDs = explode('|', $UserIDs);
|
||||
if(!$EndTime) { $EndTime = sqltime(); }
|
||||
if (!$EndTime) {
|
||||
$EndTime = sqltime();
|
||||
}
|
||||
if ($UserIDs[0] != 0) {
|
||||
$HasDupe = true;
|
||||
$UserStartTimes = explode('|', $UserStartTimes);
|
||||
@ -182,8 +196,7 @@ function UnBan(ip, id, elemID) {
|
||||
?>
|
||||
<tr class="rowa">
|
||||
<td>
|
||||
<?=$IP?> (<?=Tools::get_country_code_by_ajax($IP)?>)
|
||||
<?
|
||||
<?=$IP?> (<?=Tools::get_country_code_by_ajax($IP)?>)<?
|
||||
if ($CanManageIPBans) {
|
||||
if (!isset($IPs[$IP])) {
|
||||
$sql = "SELECT ID, FromIP, ToIP FROM ip_bans WHERE '".Tools::ip_to_unsigned($IP)."' BETWEEN FromIP AND ToIP LIMIT 1";
|
||||
@ -217,7 +230,9 @@ function UnBan(ip, id, elemID) {
|
||||
if ($HasDupe) {
|
||||
$HideMe = (count($UserIDs) > 10);
|
||||
foreach ($UserIDs as $Key => $Val) {
|
||||
if(!$UserEndTimes[$Key]){ $UserEndTimes[$Key] = sqltime(); }
|
||||
if (!$UserEndTimes[$Key]) {
|
||||
$UserEndTimes[$Key] = sqltime();
|
||||
}
|
||||
?>
|
||||
<tr class="rowb<?=($HideMe ? ' hidden' : '')?>" name="<?=$Index?>">
|
||||
<td> » <?=Users::format_username($Val, true, true, true)?></td>
|
||||
|
@ -11,9 +11,17 @@
|
||||
************************************************************************/
|
||||
|
||||
$UserID = $_GET['userid'];
|
||||
if (!is_number($UserID)) { error(404); }
|
||||
if (!is_number($UserID)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT um.Username, p.Level AS Class FROM users_main AS um LEFT JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = ".$UserID);
|
||||
$DB->query("
|
||||
SELECT
|
||||
um.Username,
|
||||
p.Level AS Class
|
||||
FROM users_main AS um
|
||||
LEFT JOIN permissions AS p ON p.ID=um.PermissionID
|
||||
WHERE um.ID = ".$UserID);
|
||||
list($Username, $Class) = $DB->next_record();
|
||||
|
||||
if (!check_perms('users_view_keys', $Class)) {
|
||||
@ -22,7 +30,8 @@
|
||||
|
||||
View::show_header("PassKey history for $Username");
|
||||
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
OldPassKey,
|
||||
NewPassKey,
|
||||
ChangeTime,
|
||||
|
@ -11,9 +11,17 @@
|
||||
************************************************************************/
|
||||
|
||||
$UserID = $_GET['userid'];
|
||||
if (!is_number($UserID)) { error(404); }
|
||||
if (!is_number($UserID)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT um.Username, p.Level AS Class FROM users_main AS um LEFT JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = ".$UserID);
|
||||
$DB->query("
|
||||
SELECT
|
||||
um.Username,
|
||||
p.Level AS Class
|
||||
FROM users_main AS um
|
||||
LEFT JOIN permissions AS p ON p.ID=um.PermissionID
|
||||
WHERE um.ID = ".$UserID);
|
||||
list($Username, $Class) = $DB->next_record();
|
||||
|
||||
if (!check_perms('users_view_keys', $Class)) {
|
||||
@ -22,7 +30,8 @@
|
||||
|
||||
View::show_header("Password reset history for $Username");
|
||||
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
ChangeTime,
|
||||
ChangerIP
|
||||
FROM users_history_passwords
|
||||
|
@ -98,7 +98,8 @@
|
||||
if ($Results > $PerPage*($Page-1)) {
|
||||
$DB->set_query_id($PostIDs);
|
||||
$PostIDs = $DB->collect('ID');
|
||||
$sql = 'SELECT
|
||||
$sql = '
|
||||
SELECT
|
||||
p.ID,
|
||||
p.AddedTime,
|
||||
p.Body,
|
||||
@ -189,7 +190,7 @@
|
||||
<h2>
|
||||
<?
|
||||
if ($ShowGrouped) {
|
||||
echo "Grouped ".($ShowUnread?"unread ":"")."post history for <a href=\"user.php?id=$UserID\">$Username</a>";
|
||||
echo 'Grouped '.($ShowUnread ? 'unread ' : '')."post history for <a href=\"user.php?id=$UserID\">$Username</a>";
|
||||
}
|
||||
elseif ($ShowUnread) {
|
||||
echo "Unread post history for <a href=\"user.php?id=$UserID\">$Username</a>";
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?
|
||||
authorize();
|
||||
|
||||
//Todo, check that loggeduser > edit
|
||||
if(!is_number($_POST['article']) || $_POST['article'] == ''){ error(0); }
|
||||
//TODO, check that loggeduser > edit
|
||||
if (!is_number($_POST['article']) || $_POST['article'] == '') {
|
||||
error(0);
|
||||
}
|
||||
|
||||
$ArticleID = $_POST['article'];
|
||||
$NewAlias = $Alias->convert($_POST['alias']);
|
||||
|
@ -1,10 +1,14 @@
|
||||
<?
|
||||
if(!isset($_GET['id']) || !is_number($_GET['id'])) { error(404); }
|
||||
if (!isset($_GET['id']) || !is_number($_GET['id'])) {
|
||||
error(404);
|
||||
}
|
||||
$ArticleID = $_GET['id'];
|
||||
|
||||
$Latest = $Alias->article($ArticleID);
|
||||
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest);
|
||||
if($Edit > $LoggedUser['EffectiveClass']){ error(404); }
|
||||
if ($Edit > $LoggedUser['EffectiveClass']) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
View::show_header($Title." Aliases");
|
||||
?>
|
||||
|
@ -33,7 +33,9 @@
|
||||
}
|
||||
$Article = $Alias->article($ArticleID);
|
||||
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
|
||||
if($Read > $LoggedUser['EffectiveClass']){ error('You must be a higher user class to view this wiki article'); }
|
||||
if ($Read > $LoggedUser['EffectiveClass']) {
|
||||
error('You must be a higher user class to view this wiki article');
|
||||
}
|
||||
|
||||
$TextBody = $Text->full_format($Body, false);
|
||||
$TOC = $Text->parse_toc(0);
|
||||
|
@ -8,7 +8,9 @@ function diff($OldText, $NewText) {
|
||||
|
||||
foreach ($LineArrayOld as $OldLine => $OldString) {
|
||||
$Key = $OldLine + $LineOffset;
|
||||
if($Key<0) { $Key = 0; }
|
||||
if ($Key < 0) {
|
||||
$Key = 0;
|
||||
}
|
||||
$Found = -1;
|
||||
|
||||
while ($Key<count($LineArrayNew)) {
|
||||
@ -57,7 +59,9 @@ function get_body($ID, $Rev) {
|
||||
$Str = $Body;
|
||||
} else {
|
||||
$DB->query("SELECT Body FROM wiki_revisions WHERE ID='$ID' AND Revision='$Rev'");
|
||||
if(!$DB->record_count()) { error(404); }
|
||||
if (!$DB->record_count()) {
|
||||
error(404);
|
||||
}
|
||||
list($Str) = $DB->next_record();
|
||||
}
|
||||
return $Str;
|
||||
@ -77,7 +81,9 @@ function get_body($ID, $Rev) {
|
||||
|
||||
$Article = $Alias->article($ArticleID);
|
||||
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Article);
|
||||
if($Read > $LoggedUser['EffectiveClass']){ error(404); }
|
||||
if ($Read > $LoggedUser['EffectiveClass']) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
View::show_header('Compare Article Revisions');
|
||||
$Diff2 = get_body($ArticleID, $_GET['new']);
|
||||
|
@ -19,12 +19,12 @@
|
||||
<h3>Body </h3>
|
||||
<?
|
||||
$ReplyText = new TEXTAREA_PREVIEW('body', 'body', '', 91, 22, true, false);
|
||||
?>
|
||||
<? if(check_perms('admin_manage_wiki')){ ?>
|
||||
|
||||
if (check_perms('admin_manage_wiki')) { ?>
|
||||
<h3>Access</h3>
|
||||
<p>There are some situations in which the viewing or editing of an article should be restricted to a certain class.</p>
|
||||
<strong>Restrict Read:</strong> <select name="minclassread"><?=class_list()?></select>
|
||||
<strong>Restrict Edit:</strong> <select name="minclassedit"><?=class_list()?></select>
|
||||
<strong>Restrict read:</strong> <select name="minclassread"><?=class_list()?></select>
|
||||
<strong>Restrict edit:</strong> <select name="minclassedit"><?=class_list()?></select>
|
||||
<? } ?>
|
||||
<div style="text-align: center;">
|
||||
<input type="button" value="Preview" class="hidden button_preview_<?=$ReplyText->getID()?>" title="Preview text" tabindex="1" />
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?
|
||||
if(!is_number($_GET['id']) || $_GET['id'] == ''){ error(404); }
|
||||
if (!is_number($_GET['id']) || $_GET['id'] == '') {
|
||||
error(404);
|
||||
}
|
||||
$ArticleID = $_GET['id'];
|
||||
|
||||
$Article = $Alias->article($ArticleID);
|
||||
@ -23,12 +25,12 @@
|
||||
<h3>Body </h3>
|
||||
<?
|
||||
$ReplyText = new TEXTAREA_PREVIEW('body', 'body', $Body, 91, 22, true, false);
|
||||
?>
|
||||
<? if(check_perms('admin_manage_wiki')){ ?>
|
||||
|
||||
if (check_perms('admin_manage_wiki')) { ?>
|
||||
<h3>Access</h3>
|
||||
<p>There are some situations in which the viewing or editing of an article should be restricted to a certain class.</p>
|
||||
<strong>Restrict Read:</strong> <select name="minclassread"><?=class_list($Read)?></select>
|
||||
<strong>Restrict Edit:</strong> <select name="minclassedit"><?=class_list($Edit)?></select>
|
||||
<strong>Restrict read:</strong> <select name="minclassread"><?=class_list($Read)?></select>
|
||||
<strong>Restrict edit:</strong> <select name="minclassedit"><?=class_list($Edit)?></select>
|
||||
<? } ?>
|
||||
<div style="text-align: center;">
|
||||
<input type="button" value="Preview" class="hidden button_preview_<?=$ReplyText->getID()?>" title="Preview text" tabindex="1" />
|
||||
|
@ -1,11 +1,17 @@
|
||||
<?
|
||||
if(!isset($_GET['id']) || !is_number($_GET['id'])) { error(404); }
|
||||
if (!isset($_GET['id']) || !is_number($_GET['id'])) {
|
||||
error(404);
|
||||
}
|
||||
$ArticleID = $_GET['id'];
|
||||
|
||||
$Latest = $Alias->article($ArticleID);
|
||||
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest);
|
||||
if($Read > $LoggedUser['EffectiveClass']){ error(404); }
|
||||
if($Edit > $LoggedUser['EffectiveClass']){ error(403); }
|
||||
if ($Read > $LoggedUser['EffectiveClass']) {
|
||||
error(404);
|
||||
}
|
||||
if ($Edit > $LoggedUser['EffectiveClass']) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
View::show_header("Revisions of ".$Title);
|
||||
?>
|
||||
@ -34,7 +40,8 @@
|
||||
<td><input type="radio" name="new" value="<?=$Revision?>" checked="checked" /></td>
|
||||
</tr>
|
||||
<?
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
w.Revision,
|
||||
w.Title,
|
||||
w.Author,
|
||||
|
@ -18,21 +18,30 @@
|
||||
// What are we looking for? Let's make sure it isn't dangerous.
|
||||
$Search = db_string(trim($_GET['search']));
|
||||
|
||||
if(!in_array($Type, array('w.Title', 'w.Body'))) { $Type = 'w.Title'; }
|
||||
if (!in_array($Type, array('w.Title', 'w.Body'))) {
|
||||
$Type = 'w.Title';
|
||||
}
|
||||
|
||||
// Break search string down into individual words
|
||||
$Words = explode(' ', $Search);
|
||||
|
||||
$Type = $TypeTable[$_GET['type']];
|
||||
if(!$Type) { $Type = 'w.Title'; }
|
||||
if (!$Type) {
|
||||
$Type = 'w.Title';
|
||||
}
|
||||
|
||||
$Order = $OrderTable[$_GET['order']];
|
||||
if(!$Order) { $Order = 'ID'; }
|
||||
if (!$Order) {
|
||||
$Order = 'ID';
|
||||
}
|
||||
|
||||
$Way = $WayTable[$_GET['way']];
|
||||
if(!$Way) { $Way = 'DESC'; }
|
||||
if (!$Way) {
|
||||
$Way = 'DESC';
|
||||
}
|
||||
|
||||
$SQL = "SELECT SQL_CALC_FOUND_ROWS
|
||||
$SQL = "
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
w.ID,
|
||||
w.Title,
|
||||
w.Date,
|
||||
@ -82,8 +91,7 @@
|
||||
<td class="label"><strong>Order by:</strong></td>
|
||||
<td>
|
||||
<select name="order">
|
||||
<?
|
||||
foreach($OrderVals as $Cur){ ?>
|
||||
<? foreach ($OrderVals as $Cur) { ?>
|
||||
<option value="<?=$Cur?>"<? if ($_GET['order'] == $Cur || (!$_GET['order'] && $Cur == 'Time')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
|
@ -26,10 +26,18 @@
|
||||
if (check_perms('admin_manage_wiki')) {
|
||||
$Read = $_POST['minclassread'];
|
||||
$Edit = $_POST['minclassedit'];
|
||||
if(!is_number($Read)) { error(0); } //int?
|
||||
if(!is_number($Edit)) { error(0); }
|
||||
if($Edit > $LoggedUser['EffectiveClass']){ error('You can\'t restrict articles above your own level'); }
|
||||
if($Edit < $Read){ $Edit = $Read; } //Human error fix.
|
||||
if (!is_number($Read)) {
|
||||
error(0); //int?
|
||||
}
|
||||
if (!is_number($Edit)) {
|
||||
error(0);
|
||||
}
|
||||
if ($Edit > $LoggedUser['EffectiveClass']) {
|
||||
error('You can\'t restrict articles above your own level');
|
||||
}
|
||||
if ($Edit < $Read) {
|
||||
$Edit = $Read; //Human error fix.
|
||||
}
|
||||
} else {
|
||||
$Read=100;
|
||||
$Edit=100;
|
||||
|
@ -4,7 +4,9 @@
|
||||
include(SERVER_ROOT.'/classes/class_validate.php');
|
||||
$Val = new VALIDATE;
|
||||
|
||||
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
|
||||
if (!is_number($_POST['id']) || $_POST['id'] == '') {
|
||||
error(0);
|
||||
}
|
||||
$Val->SetFields('title', '1','string','The title must be between 3 and 100 characters',array('maxlength'=>100, 'minlength'=>3));
|
||||
$Err = $Val->ValidateForm($_POST);
|
||||
$ArticleID = $_POST['id'];
|
||||
@ -18,19 +20,31 @@
|
||||
|
||||
$Article = $Alias->article($ArticleID);
|
||||
list($Revision, $Title, $Body, $CurRead, $CurEdit, $Date, $Author) = array_shift($Article);
|
||||
if($CurEdit > $LoggedUser['EffectiveClass']){ error(403); }
|
||||
if ($CurEdit > $LoggedUser['EffectiveClass']) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if (check_perms('admin_manage_wiki')) {
|
||||
$Read=$_POST['minclassread'];
|
||||
$Edit=$_POST['minclassedit'];
|
||||
if(!is_number($Read)) { error(0); } //int?
|
||||
if(!is_number($Edit)) { error(0); }
|
||||
if($Edit > $LoggedUser['EffectiveClass']){ error('You can\'t restrict articles above your own level.'); }
|
||||
if($Edit < $Read){ $Edit = $Read; } //Human error fix.
|
||||
if (!is_number($Read)) {
|
||||
error(0); //int?
|
||||
}
|
||||
if (!is_number($Edit)) {
|
||||
error(0);
|
||||
}
|
||||
if ($Edit > $LoggedUser['EffectiveClass']) {
|
||||
error('You can\'t restrict articles above your own level.');
|
||||
}
|
||||
if ($Edit < $Read) {
|
||||
$Edit = $Read; //Human error fix.
|
||||
}
|
||||
}
|
||||
|
||||
$MyRevision = $_POST['revision'];
|
||||
if($MyRevision!=$Revision){ error('This article has already been modified from its original version.'); }
|
||||
if ($MyRevision != $Revision) {
|
||||
error('This article has already been modified from its original version.');
|
||||
}
|
||||
|
||||
$DB->query("INSERT INTO wiki_revisions (ID, Revision, Title, Body, Date, Author) VALUES ('".db_string($ArticleID)."', '".db_string($Revision)."', '".db_string($Title)."', '".db_string($Body)."', '".db_string($Date)."', '".db_string($Author)."')");
|
||||
$SQL = "UPDATE wiki_articles SET
|
||||
|
Loading…
Reference in New Issue
Block a user