Skip to content

Commit 08b4078

Browse files
committed
May Update #1
1 parent 58e1892 commit 08b4078

File tree

112 files changed

+5926
-4650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+5926
-4650
lines changed

_functions.php

Lines changed: 86 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ function filterText($strText) {
4848
return $temp;
4949
}
5050

51-
function getPreciseTime($intTime, $timeFormat="") {
51+
function getPreciseTime($intTime, $timeFormat="", $bypassTimeDiff=false) {
5252

53-
$timeDiff = time() - $intTime;
53+
$timeDiff = (!$bypassTimeDiff) ? time() - $intTime : 99999;
5454

5555
if($timeDiff < 3) {
5656
$dispLastDate = "just now";
@@ -114,8 +114,8 @@ function parseBBCode($strText) {
114114

115115
foreach($arrBBCodes as $bbCode) {
116116

117-
$strText = str_replace($bbCode['bbOpenTag'],$bbCode['htmlOpenTag'],$strText);
118-
$strText = str_replace($bbCode['bbCloseTag'],$bbCode['htmlCloseTag'],$strText);
117+
$strText = str_ireplace($bbCode['bbOpenTag'],$bbCode['htmlOpenTag'],$strText);
118+
$strText = str_ireplace($bbCode['bbCloseTag'],$bbCode['htmlCloseTag'],$strText);
119119

120120
}
121121

@@ -127,23 +127,26 @@ function parseBBCode($strText) {
127127
foreach($arrEmoticonCodes as $key => $value) {
128128

129129
$imgURL = "<img src='".$MAIN_ROOT."images/emoticons/".$arrEmoticonImg[$key]."' width='15' height='15'>";
130-
$strText = str_replace($value, $imgURL, $strText);
130+
$strText = str_ireplace($value, $imgURL, $strText);
131131

132132
}
133133

134134

135135
// Complex Codes, ex. Links, colors...
136136

137-
$strText = preg_replace("/\[url\](.*)\[\/url\]/", "<a href='$1' target='_blank'>$1</a>", $strText); // Links no Titles
138-
$strText = preg_replace("/\[url=(.*)\](.*)\[\/url\]/", "<a href='$1' target='_blank'>$2</a>", $strText); // Links with Titles
139-
$strText = preg_replace("/\[color=(.*)\](.*)\[\/color\]/", "<span style='color: $1'>$2</span>", $strText); // Text Color
137+
$strText = preg_replace("/\[url](.*?)\[\/url]/i", "<a href='$1' target='_blank'>$1</a>", $strText); // Links no Titles
138+
$strText = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/i", "<a href='$1' target='_blank'>$2</a>", $strText); // Links with Titles
139+
140+
140141

142+
$strText = preg_replace("/\[color=(.*)\](.*)\[\/color\]/i", "<span style='color: $1'>$2</span>", $strText); // Text Color
143+
141144
$strText = str_replace("[/youtube]", "[/youtube]\n", $strText);
142-
$strText = preg_replace("/\[youtube\](http|https)(\:\/\/www\.youtube\.com\/watch\?v\=)(.*)\[\/youtube\]/", "<iframe class='youtubeEmbed' src='http://www.youtube.com/embed/$3?wmode=opaque' frameborder='0' allowfullscreen></iframe>", $strText);
143-
$strText = preg_replace("/\[\youtube\](http|https)(\:\/\/youtu\.be\/)(.*)\[\/youtube\]/", "<iframe class='youtubeEmbed' src='http://www.youtube.com/embed/$3?wmode=opaque' frameborder='0' allowfullscreen></iframe>", $strText);
145+
$strText = preg_replace("/\[youtube\](http|https)(\:\/\/www\.youtube\.com\/watch\?v\=)(.*)\[\/youtube\]/i", "<iframe class='youtubeEmbed' src='http://www.youtube.com/embed/$3?wmode=opaque' frameborder='0' allowfullscreen></iframe>", $strText);
146+
$strText = preg_replace("/\[\youtube\](http|https)(\:\/\/youtu\.be\/)(.*)\[\/youtube\]/i", "<iframe class='youtubeEmbed' src='http://www.youtube.com/embed/$3?wmode=opaque' frameborder='0' allowfullscreen></iframe>", $strText);
144147

145148
$strText = str_replace("[/twitch]", "[/twitch]\n", $strText);
146-
$strText = preg_replace("/\[twitch\](http|https)(\:\/\/www\.twitch\.tv\/)(.*)\[\/twitch\]/", "<object class='youtubeEmbed' type='application/x-shockwave-flash' id='live_embed_player_flash' data='http://www.twitch.tv/widgets/live_embed_player.swf?channel=$3' bgcolor='#000000'><param name='allowFullScreen' value='true' /><param name='wmode' value='opaque' /><param name='allowScriptAccess' value='always' /><param name='allowNetworking' value='all' /><param name='movie' value='http://www.twitch.tv/widgets/live_embed_player.swf' /><param name='flashvars' value='hostname=www.twitch.tv&channel=$3&auto_play=false&start_volume=25' /></object>", $strText);
149+
$strText = preg_replace("/\[twitch\](http|https)(\:\/\/www\.twitch\.tv\/)(.*)\[\/twitch\]/i", "<object class='youtubeEmbed' type='application/x-shockwave-flash' id='live_embed_player_flash' data='http://www.twitch.tv/widgets/live_embed_player.swf?channel=$3' bgcolor='#000000'><param name='allowFullScreen' value='true' /><param name='wmode' value='opaque' /><param name='allowScriptAccess' value='always' /><param name='allowNetworking' value='all' /><param name='movie' value='http://www.twitch.tv/widgets/live_embed_player.swf' /><param name='flashvars' value='hostname=www.twitch.tv&channel=$3&auto_play=false&start_volume=25' /></object>", $strText);
147150

148151
$strText = autolink($strText);
149152

@@ -162,6 +165,78 @@ function autoLinkImage($strText) {
162165
}
163166

164167

168+
function __autoload($class_name) {
169+
global $prevFolder;
170+
include_once($prevFolder."classes/".$class_name.".php");
171+
}
172+
165173

174+
//======================== START OF FUNCTION ==========================//
175+
// FUNCTION: bbcode_to_html //
176+
//=====================================================================//
177+
function bbcode_to_html($bbtext){
178+
$bbtags = array(
179+
'[heading1]' => '<h1>','[/heading1]' => '</h1>',
180+
'[heading2]' => '<h2>','[/heading2]' => '</h2>',
181+
'[heading3]' => '<h3>','[/heading3]' => '</h3>',
182+
'[h1]' => '<h1>','[/h1]' => '</h1>',
183+
'[h2]' => '<h2>','[/h2]' => '</h2>',
184+
'[h3]' => '<h3>','[/h3]' => '</h3>',
185+
186+
'[paragraph]' => '<p>','[/paragraph]' => '</p>',
187+
'[para]' => '<p>','[/para]' => '</p>',
188+
'[p]' => '<p>','[/p]' => '</p>',
189+
'[left]' => '<p style="text-align:left;">','[/left]' => '</p>',
190+
'[right]' => '<p style="text-align:right;">','[/right]' => '</p>',
191+
'[center]' => '<p style="text-align:center;">','[/center]' => '</p>',
192+
'[justify]' => '<p style="text-align:justify;">','[/justify]' => '</p>',
193+
194+
'[bold]' => '<span style="font-weight:bold;">','[/bold]' => '</span>',
195+
'[italic]' => '<span style="font-weight:bold;">','[/italic]' => '</span>',
196+
'[underline]' => '<span style="text-decoration:underline;">','[/underline]' => '</span>',
197+
'[b]' => '<span style="font-weight:bold;">','[/b]' => '</span>',
198+
'[i]' => '<span style="font-weight:bold;">','[/i]' => '</span>',
199+
'[u]' => '<span style="text-decoration:underline;">','[/u]' => '</span>',
200+
'[break]' => '<br>',
201+
'[br]' => '<br>',
202+
'[newline]' => '<br>',
203+
'[nl]' => '<br>',
204+
205+
'[unordered_list]' => '<ul>','[/unordered_list]' => '</ul>',
206+
'[list]' => '<ul>','[/list]' => '</ul>',
207+
'[ul]' => '<ul>','[/ul]' => '</ul>',
208+
209+
'[ordered_list]' => '<ol>','[/ordered_list]' => '</ol>',
210+
'[ol]' => '<ol>','[/ol]' => '</ol>',
211+
'[list_item]' => '<li>','[/list_item]' => '</li>',
212+
'[li]' => '<li>','[/li]' => '</li>',
213+
214+
'[*]' => '<li>','[/*]' => '</li>',
215+
'[code]' => '<code>','[/code]' => '</code>',
216+
'[preformatted]' => '<pre>','[/preformatted]' => '</pre>',
217+
'[pre]' => '<pre>','[/pre]' => '</pre>',
218+
);
219+
220+
$bbtext = str_ireplace(array_keys($bbtags), array_values($bbtags), $bbtext);
221+
222+
$bbextended = array(
223+
"/\[url](.*?)\[\/url]/i" => "<a href=\"http://$1\" title=\"$1\">$1</a>",
224+
"/\[url=(.*?)\](.*?)\[\/url\]/i" => "<a href=\"$1\" title=\"$1\">$2</a>",
225+
"/\[email=(.*?)\](.*?)\[\/email\]/i" => "<a href=\"mailto:$1\">$2</a>",
226+
"/\[mail=(.*?)\](.*?)\[\/mail\]/i" => "<a href=\"mailto:$1\">$2</a>",
227+
"/\[img\]([^[]*)\[\/img\]/i" => "<img src=\"$1\" alt=\" \" />",
228+
"/\[image\]([^[]*)\[\/image\]/i" => "<img src=\"$1\" alt=\" \" />",
229+
"/\[image_left\]([^[]*)\[\/image_left\]/i" => "<img src=\"$1\" alt=\" \" class=\"img_left\" />",
230+
"/\[image_right\]([^[]*)\[\/image_right\]/i" => "<img src=\"$1\" alt=\" \" class=\"img_right\" />",
231+
);
232+
233+
foreach($bbextended as $match=>$replacement){
234+
$bbtext = preg_replace($match, $replacement, $bbtext);
235+
}
236+
return $bbtext;
237+
}
238+
//=====================================================================//
239+
// FUNCTION: bbcode_to_html //
240+
//========================= END OF FUNCTION ===========================//
166241

167242
?>

_setup.php

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,42 @@
1616
// This setup page should not be changed. Edit _config.php to configure your website.
1717

1818
ini_set('display_errors', 0);
19+
ini_set('session.use_only_cookies', 1);
20+
ini_set('session.gc_maxlifetime', 60*60*24*3);
1921

2022
if(get_magic_quotes_gpc() == 1) {
2123
foreach($_GET as $key=>$value) { $_GET[$key] = stripslashes($value); }
2224
foreach($_POST as $key=>$value) { $_POST[$key] = stripslashes($value); }
2325
}
2426

2527

26-
if(isset($_COOKIE['btSessionID']) && $_COOKIE['btSessionID'] != "") {
27-
session_id($_COOKIE['btSessionID']);
28+
if(isset($_COOKIE['btUsername']) && isset($_COOKIE['btPassword'])) {
2829
session_start();
29-
ini_set('session.use_only_cookies', 1);
30+
$_SESSION['btUsername'] = $_COOKIE['btUsername'];
31+
$_SESSION['btPassword'] = $_COOKIE['btPassword'];
3032
}
3133
else {
3234
session_start();
33-
ini_set('session.use_only_cookies', 1);
34-
if(isset($_SESSION['btRememberMe']) && $_SESSION['btRememberMe'] == 1 && (!isset($_COOKIE['btSessionID']) || $_COOKIE['btSessionID'] == "")) {
35-
$cookieExpTime = time()+((60*60*24)*3);
36-
setcookie("btSessionID", session_id(), $cookieExpTime);
37-
}
35+
}
36+
37+
if(!isset($_SESSION['csrfKey'])) {
38+
$_SESSION['csrfKey'] = md5(uniqid());
3839
}
3940

4041
include($prevFolder."_config.php");
4142
$PAGE_NAME = "";
42-
43-
include_once($prevFolder."classes/btmysql.php");
44-
include_once($prevFolder."classes/basic.php");
4543
include_once($prevFolder."_functions.php");
46-
include_once($prevFolder."classes/ipban.php");
47-
4844

4945
$mysqli = new btmysql($dbhost, $dbuser, $dbpass, $dbname);
5046

47+
5148
$mysqli->set_tablePrefix($dbprefix);
5249
$mysqli->set_testingMode(true);
5350

5451
$logObj = new Basic($mysqli, "logs", "log_id");
5552

5653
// Get Clan Info
57-
$webInfoObj = new Basic($mysqli, "websiteinfo", "websiteinfo_id");
54+
$webInfoObj = new WebsiteInfo($mysqli);
5855

5956
$webInfoObj->select(1);
6057

@@ -80,31 +77,17 @@
8077
ini_set('error_reporting', E_ALL);
8178
}
8279
else {
83-
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING && ~E_STRICT);
80+
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT);
8481
ini_set('display_errors', 1);
8582
}
8683

8784

8885
// Check for Ban
89-
/*
90-
$ipbanObj = new Basic($mysqli, "ipban", "ipaddress");
91-
92-
if($ipbanObj->select($IP_ADDRESS, false)) {
93-
$ipbanInfo = $ipbanObj->get_info();
94-
95-
if(time() < $ipbanInfo['exptime'] OR $ipbanInfo['exptime'] == 0) {
96-
die("<script type='text/javascript'>window.location = '".$MAIN_ROOT."banned.php';</script>");
97-
}
98-
else {
99-
$ipbanObj->delete();
100-
}
101-
102-
}
103-
*/
10486

10587
$ipbanObj = new IPBan($mysqli);
10688
if($ipbanObj->isBanned($IP_ADDRESS)) {
10789
die("<script type='text/javascript'>window.location = '".$MAIN_ROOT."banned.php';</script>");
10890
}
10991

92+
$hooksObj = new btHooks();
11093
?>

classes/basic.php

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ public function select($intIDNum, $numericIDOnly = true) {
5454
$checkID = is_numeric($intIDNum);
5555
}
5656

57-
5857

5958
if($checkID) {
60-
6159
$result = $this->MySQL->query("SELECT * FROM ".$this->strTableName." WHERE ".$this->strTableKey." = '$intIDNum'");
6260
if($result->num_rows > 0) {
6361
$this->arrObjInfo = $result->fetch_assoc();
@@ -71,6 +69,85 @@ public function select($intIDNum, $numericIDOnly = true) {
7169
}
7270

7371

72+
/*
73+
* Get multi rows, returns an array of get_info_filtered,
74+
*
75+
* Format filterArgs array as array[columnName] = value
76+
*
77+
*/
78+
79+
public function get_entries($filterArgs=array(), $orderBy="", $blnNotFiltered=true, $filterComparators=array()) {
80+
81+
$returnVal = false;
82+
$returnArr = array();
83+
$arrSelect = array();
84+
$selectBackID = "";
85+
86+
if($this->intTableKeyValue != "") {
87+
$selectBackID = $this->intTableKeyValue;
88+
}
89+
90+
$setSQL = "";
91+
if(count($filterArgs) > 0) {
92+
93+
$arrSQL = array();
94+
foreach($filterArgs as $columnName => $value) {
95+
96+
$setComparator = isset($filterComparators[$columnName]) ? $filterComparators[$columnName] : "=";
97+
98+
$arrSQL[] = $columnName." ".$setComparator." ?";
99+
100+
}
101+
102+
$setSQL = implode(" AND ", $arrSQL);
103+
104+
if($setSQL != "") {
105+
$setSQL = " WHERE ".$setSQL;
106+
}
107+
}
108+
109+
if($orderBy != "") {
110+
$orderBy = "ORDER BY ".$orderBy;
111+
}
112+
113+
$query = "SELECT ".$this->strTableKey." FROM ".$this->strTableName.$setSQL." ".$orderBy;
114+
$stmt = $this->MySQL->prepare($query);
115+
$returnID = "";
116+
117+
if($stmt) {
118+
119+
if(count($filterArgs) > 0) {
120+
$this->MySQL->bindParams($stmt, $filterArgs);
121+
}
122+
123+
$stmt->execute();
124+
$stmt->bind_result($result);
125+
126+
while($stmt->fetch()) {
127+
128+
$arrSelect[] = $result;
129+
130+
}
131+
132+
$stmt->close();
133+
134+
}
135+
136+
foreach($arrSelect as $selectKey) {
137+
$this->select($selectKey);
138+
$returnArr[] = $blnNotFiltered ? $this->get_info_filtered() : $this->get_info();
139+
}
140+
141+
142+
if($selectBackID != "") {
143+
$this->select($selectBackID);
144+
}
145+
146+
return $returnArr;
147+
148+
}
149+
150+
74151
/*
75152
76153
-Easy way to send an INSERT statement-
@@ -116,7 +193,6 @@ public function addNew($arrColumns, $arrValues) {
116193

117194
$stmt = $this->MySQL->bindParams($stmt, $arrValues);
118195

119-
120196
}
121197

122198

classes/basicsort.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ function findBeforeAfter() {
343343
$addTo = 1;
344344

345345

346-
if($this->arrObjInfo['sortnum'] == $intHighestOrderNum AND $intHighestOrderNum != 1) {
346+
if($this->arrObjInfo['sortnum'] == $intHighestOrderNum && $intHighestOrderNum != 1) {
347347
$strBeforeAfter = "after";
348348
$addTo = -1;
349349
}

0 commit comments

Comments
 (0)