Skip to content

Commit f29f156

Browse files
first commit
0 parents  commit f29f156

File tree

1,293 files changed

+157474
-0
lines changed

Some content is hidden

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

1,293 files changed

+157474
-0
lines changed

_functions.php

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
<?php
2+
3+
/*
4+
* Bluethrust Clan Scripts v4
5+
* Copyright 2014
6+
*
7+
* Author: Bluethrust Web Development
8+
9+
* Website: http://www.bluethrust.com
10+
*
11+
* License: http://www.bluethrust.com/license.php
12+
*
13+
*/
14+
15+
16+
17+
include($prevFolder."include/lib_autolink/lib_autolink.php");
18+
19+
20+
// General functions to filter out all <, >, ", and ' symbols
21+
function filterArray($arrValues) {
22+
$newArray = array();
23+
foreach($arrValues as $key => $value) {
24+
$temp = str_replace("<", "&lt;", $value);
25+
$value = str_replace(">", "&gt;", $temp);
26+
$temp = str_replace("'", "&#39;", $value);
27+
$value = str_replace('"', '&quot;', $temp);
28+
$temp = str_replace("&middot;", "&#38;middot;", $value);
29+
$temp = str_replace("&raquo;", "&#38;raquo;", $temp);
30+
$temp = str_replace("&laquo;", "&#38;laquo;", $temp);
31+
32+
$newArray[$key] = $temp;
33+
}
34+
return $newArray;
35+
}
36+
37+
function filterText($strText) {
38+
$temp = str_replace("<", "&lt;", $strText);
39+
$value = str_replace(">", "&gt;", $temp);
40+
$temp = str_replace("'", "&#39;", $value);
41+
$value = str_replace('"', '&quot;', $temp);
42+
$temp = str_replace("&middot;", "&#38;middot;", $value);
43+
$temp = str_replace("&raquo;", "&#38;raquo;", $temp);
44+
$temp = str_replace("&laquo;", "&#38;laquo;", $temp);
45+
46+
47+
48+
return $temp;
49+
}
50+
51+
function getPreciseTime($intTime, $timeFormat="", $bypassTimeDiff=false) {
52+
53+
$timeDiff = (!$bypassTimeDiff) ? time() - $intTime : 99999;
54+
55+
if($timeDiff < 3) {
56+
$dispLastDate = "just now";
57+
}
58+
elseif($timeDiff < 60) {
59+
$dispLastDate = "$timeDiff seconds ago";
60+
}
61+
elseif($timeDiff < 3600) {
62+
$minDiff = round($timeDiff/60);
63+
$dispMinute = "minutes";
64+
if($minDiff == 1) {
65+
$dispMinute = "minute";
66+
}
67+
68+
$dispLastDate = "$minDiff $dispMinute ago";
69+
}
70+
elseif($timeDiff < 86400) {
71+
$hourDiff = round($timeDiff/3600);
72+
$dispHour = "hours";
73+
if($hourDiff == 1) {
74+
$dispHour = "hour";
75+
}
76+
77+
$dispLastDate = "$hourDiff $dispHour ago";
78+
}
79+
else {
80+
81+
if($timeFormat == "") {
82+
$timeFormat = "D M j, Y g:i a";
83+
}
84+
85+
86+
$dispLastDate = date($timeFormat, $intTime);
87+
}
88+
89+
return $dispLastDate;
90+
91+
}
92+
93+
function parseBBCode($strText) {
94+
global $MAIN_ROOT;
95+
96+
// Basic Codes
97+
98+
$arrBBCodes['Bold'] = array("bbOpenTag" => "[b]", "bbCloseTag" => "[/b]", "htmlOpenTag" => "<span style='font-weight: bold'>", "htmlCloseTag" => "</span>");
99+
$arrBBCodes['Italic'] = array("bbOpenTag" => "[i]", "bbCloseTag" => "[/i]", "htmlOpenTag" => "<span style='font-style: italic'>", "htmlCloseTag" => "</span>");
100+
$arrBBCodes['Underline'] = array("bbOpenTag" => "[u]", "bbCloseTag" => "[/u]", "htmlOpenTag" => "<span style='text-decoration: underline'>", "htmlCloseTag" => "</span>");
101+
$arrBBCodes['Image'] = array("bbOpenTag" => "[img]", "bbCloseTag" => "[/img]", "htmlOpenTag" => "<img src='", "htmlCloseTag" => "'>");
102+
$arrBBCodes['CenterAlign'] = array("bbOpenTag" => "[center]", "bbCloseTag" => "[/center]", "htmlOpenTag" => "<p align='center'>", "htmlCloseTag" => "</p>");
103+
$arrBBCodes['LeftAlign'] = array("bbOpenTag" => "[left]", "bbCloseTag" => "[/left]", "htmlOpenTag" => "<p align='left'>", "htmlCloseTag" => "</p>");
104+
$arrBBCodes['RightAlign'] = array("bbOpenTag" => "[right]", "bbCloseTag" => "[/right]", "htmlOpenTag" => "<p align='right'>", "htmlCloseTag" => "</p>");
105+
$arrBBCodes['Quote'] = array("bbOpenTag" => "[quote]", "bbCloseTag" => "[/quote]", "htmlOpenTag" => "<div class='forumQuote'>", "htmlCloseTag" => "</div>");
106+
$arrBBCodes['Code'] = array("bbOpenTag" => "[code]", "bbCloseTag" => "[/code]", "htmlOpenTag" => "<div class='forumCode'>", "htmlCloseTag" => "</div>");
107+
108+
$randPollDiv = "poll_".md5(time().uniqid());
109+
110+
$arrBBCodes['Poll'] = array("bbOpenTag" => "[poll]", "bbCloseTag" => "[/poll]", "htmlOpenTag" => "<div id='".$randPollDiv."'></div><script type='text/javascript'>embedPoll('".$MAIN_ROOT."', '".$randPollDiv."', '", "htmlCloseTag" => "');</script>");
111+
112+
113+
114+
115+
foreach($arrBBCodes as $bbCode) {
116+
117+
$strText = str_ireplace($bbCode['bbOpenTag'],$bbCode['htmlOpenTag'],$strText);
118+
$strText = str_ireplace($bbCode['bbCloseTag'],$bbCode['htmlCloseTag'],$strText);
119+
120+
}
121+
122+
// Emoticons
123+
124+
$arrEmoticonCodes = array(":)", ":(", ":D", ";)", ":p");
125+
$arrEmoticonImg = array("smile.png", "sad.png", "grin.png", "wink.png", "cheeky.png");
126+
127+
foreach($arrEmoticonCodes as $key => $value) {
128+
129+
$imgURL = "<img src='".$MAIN_ROOT."images/emoticons/".$arrEmoticonImg[$key]."' width='15' height='15'>";
130+
$strText = str_ireplace($value, $imgURL, $strText);
131+
132+
}
133+
134+
135+
// Complex Codes, ex. Links, colors...
136+
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+
141+
142+
$strText = preg_replace("/\[color=(.*)\](.*)\[\/color\]/i", "<span style='color: $1'>$2</span>", $strText); // Text Color
143+
144+
$strText = str_replace("[/youtube]", "[/youtube]\n", $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);
147+
148+
$strText = str_replace("[/twitch]", "[/twitch]\n", $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);
150+
151+
$strText = autolink($strText);
152+
153+
return $strText;
154+
155+
156+
}
157+
158+
function autoLinkImage($strText) {
159+
160+
$strText = preg_replace("/<img src=(\"|\')(.*)(\"|\')>/", "<a href='$2' target='_blank'><img src='$2'></a>", $strText);
161+
$strText = preg_replace("/<img src=(\"|\')(.*)(\"|\') alt=(\"|\')(.*)(\"|\') \/>/", "<a href='$2' target='_blank'><img src='$2'></a>", $strText);
162+
163+
164+
return $strText;
165+
}
166+
167+
168+
function deleteFile($filename) {
169+
$returnVal = false;
170+
if(file_exists($filename)) {
171+
$returnVal = unlink($filename);
172+
}
173+
174+
return $returnVal;
175+
}
176+
177+
178+
function getHTTP() {
179+
if(isset($_SERVER['HTTPS']) && (trim($_SERVER['HTTPS']) == "" || $_SERVER['HTTPS'] == "off")) {
180+
$dispHTTP = "http://";
181+
}
182+
else {
183+
$dispHTTP = "https://";
184+
}
185+
186+
return $dispHTTP;
187+
}
188+
189+
190+
function addArraySpace($arr, $space, $atSpot) {
191+
192+
$newArr = array();
193+
$i=0;
194+
foreach($arr as $key => $value) {
195+
196+
if($atSpot == $key) {
197+
198+
for($x=0; $x<$space; $x++) {
199+
$newArr[$i] = "";
200+
$i++;
201+
}
202+
203+
$newArr[$i] = $value;
204+
}
205+
else {
206+
$newArr[$i] = $value;
207+
}
208+
209+
$i++;
210+
}
211+
212+
return $newArr;
213+
}
214+
215+
216+
function pluralize($word, $num) {
217+
218+
if($num == 1) {
219+
$returnVal = $word;
220+
}
221+
else {
222+
$returnVal = $word."s";
223+
}
224+
225+
return $returnVal;
226+
}
227+
228+
229+
function encryptPassword($password) {
230+
231+
$randomString = substr(md5(uniqid("", true)),0,22);
232+
$randomNum = rand(4,10);
233+
if($randomNum < 10) {
234+
$randomNum = "0".$randomNum;
235+
}
236+
237+
$strSalt = "$2a$".$randomNum."$".$randomString;
238+
$encryptPassword = crypt($password, $strSalt);
239+
240+
$returnArr = array("password" => $encryptPassword, "salt" => $strSalt);
241+
242+
return $returnArr;
243+
}
244+
245+
246+
// Class Loaders
247+
248+
function BTCS4Loader($class_name) {
249+
include_once(BASE_DIRECTORY."classes/".strtolower($class_name).".php");
250+
}
251+
252+
spl_autoload_register("BTCS4Loader", true, true);
253+
254+
include_once(BASE_DIRECTORY."include/phpmailer/PHPMailerAutoload.php");
255+
?>

_setup.php

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?php
2+
3+
/*
4+
* Bluethrust Clan Scripts v4
5+
* Copyright 2014
6+
*
7+
* Author: Bluethrust Web Development
8+
9+
* Website: http://www.bluethrust.com
10+
*
11+
* License: http://www.bluethrust.com/license.php
12+
*
13+
*/
14+
15+
16+
// This setup page should not be changed. Edit _config.php to configure your website.
17+
18+
ini_set('display_errors', 0);
19+
ini_set('session.use_only_cookies', 1);
20+
ini_set('session.gc_maxlifetime', 60*60*24*3);
21+
22+
23+
24+
if(get_magic_quotes_gpc() == 1) {
25+
foreach($_GET as $key=>$value) { $_GET[$key] = stripslashes($value); }
26+
foreach($_POST as $key=>$value) { $_POST[$key] = stripslashes($value); }
27+
}
28+
29+
30+
if(isset($_COOKIE['btUsername']) && isset($_COOKIE['btPassword'])) {
31+
session_start();
32+
$_SESSION['btUsername'] = $_COOKIE['btUsername'];
33+
$_SESSION['btPassword'] = $_COOKIE['btPassword'];
34+
}
35+
else {
36+
session_start();
37+
}
38+
39+
if(!isset($_SESSION['csrfKey'])) {
40+
$_SESSION['csrfKey'] = md5(uniqid());
41+
}
42+
43+
include($prevFolder."_config.php");
44+
define("BASE_DIRECTORY", $BASE_DIRECTORY);
45+
//define("BASE_DIRECTORY", str_replace("//", "/", $_SERVER['DOCUMENT_ROOT'].$MAIN_ROOT));
46+
define("MAIN_ROOT", $MAIN_ROOT);
47+
48+
49+
$PAGE_NAME = "";
50+
include_once(BASE_DIRECTORY."_functions.php");
51+
52+
define("FULL_SITE_URL", getHTTP().$_SERVER['SERVER_NAME'].MAIN_ROOT);
53+
54+
55+
$mysqli = new btmysql($dbhost, $dbuser, $dbpass, $dbname);
56+
57+
58+
$mysqli->set_tablePrefix($dbprefix);
59+
$mysqli->set_testingMode(true);
60+
61+
$logObj = new Basic($mysqli, "logs", "log_id");
62+
63+
// Get Clan Info
64+
$webInfoObj = new WebsiteInfo($mysqli);
65+
66+
$webInfoObj->select(1);
67+
68+
$websiteInfo = $webInfoObj->get_info_filtered();
69+
$CLAN_NAME = $websiteInfo['clanname'];
70+
$THEME = $websiteInfo['theme'];
71+
define("THEME", $THEME);
72+
73+
$arrWebsiteLogoURL = parse_url($websiteInfo['logourl']);
74+
75+
76+
if(!isset($arrWebsiteLogoURL['scheme']) || $arrWebsiteLogoURL['scheme'] == "") {
77+
$websiteInfo['logourl'] = $MAIN_ROOT."themes/".$THEME."/".$websiteInfo['logourl'];
78+
}
79+
80+
81+
$IP_ADDRESS = $_SERVER['REMOTE_ADDR'];
82+
83+
// Check Debug Mode
84+
85+
if($websiteInfo['debugmode'] == 1) {
86+
ini_set('display_errors', 1);
87+
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT);
88+
}
89+
else {
90+
ini_set('display_errors', 1);
91+
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT);
92+
//ini_set('error_reporting', E_ALL);
93+
}
94+
95+
96+
// Check for Ban
97+
98+
$ipbanObj = new IPBan($mysqli);
99+
if($ipbanObj->isBanned($IP_ADDRESS)) {
100+
die("<script type='text/javascript'>window.location = '".$MAIN_ROOT."banned.php';</script>");
101+
}
102+
103+
104+
$websiteInfo['default_timezone'] = (!isset($websiteInfo['default_timezone']) || $websiteInfo['default_timezone'] == "") ? "UTC" : $websiteInfo['default_timezone'];
105+
106+
date_default_timezone_set($websiteInfo['default_timezone']);
107+
108+
109+
$hooksObj = new btHooks();
110+
$btThemeObj = new btTheme();
111+
$clockObj = new Clock($mysqli);
112+
$btThemeObj->setThemeDir($THEME);
113+
$btThemeObj->setClanName($CLAN_NAME);
114+
$btThemeObj->initHead();
115+
116+
include_once(BASE_DIRECTORY."plugins/mods.php");
117+
?>

0 commit comments

Comments
 (0)