PageRenderTime 63ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 1ms

/_settings.php

https://bitbucket.org/benjamin_cassinat/meute-apax
PHP | 266 lines | 29 code | 16 blank | 221 comment | 8 complexity | 74b77ff512fe0e0331ba1088104b1c44 MD5 | raw file
  1. <?php
  2. /*
  3. ##########################################################################
  4. # #
  5. # Version 4 / / / #
  6. # -----------__---/__---__------__----__---/---/- #
  7. # | /| / /___) / ) (_ ` / ) /___) / / #
  8. # _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ #
  9. # Free Content / Management System #
  10. # / #
  11. # #
  12. # #
  13. # Copyright 2005-2009 by webspell.org #
  14. # #
  15. # visit webSPELL.org, webspell.info to get webSPELL for free #
  16. # - Script runs under the GNU GENERAL PUBLIC LICENSE #
  17. # - It's NOT allowed to remove this copyright-tag #
  18. # -- http://www.fsf.org/licensing/licenses/gpl.html #
  19. # #
  20. # Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at), #
  21. # Far Development by Development Team - webspell.org #
  22. # #
  23. # visit webspell.org #
  24. # #
  25. ##########################################################################
  26. */
  27. // -- ERROR REPORTING -- //
  28. define('DEBUG', "OFF");
  29. error_reporting(0); // 0 = public mode, E_ALL = development-mode
  30. // -- SET ENCODING FOR MB-FUNCTIONS -- //
  31. mb_internal_encoding("UTF-8");
  32. // -- SET HTTP ENCODING -- //
  33. header('content-type: text/html; charset=utf-8');
  34. // -- CONNECTION TO MYSQL -- //
  35. mysql_connect($host, $user, $pwd) or system_error('ERROR: Can not connect to MySQL-Server');
  36. mysql_select_db($db) or system_error('ERROR: Can not connect to database "'.$db.'"');
  37. mysql_query("SET NAMES 'utf8'");
  38. // -- GENERAL PROTECTIONS -- //
  39. function globalskiller() { // kills all non-system variables
  40. $global = array('GLOBALS', '_POST', '_GET', '_COOKIE', '_FILES', '_SERVER', '_ENV', '_REQUEST', '_SESSION');
  41. foreach ($GLOBALS as $key=>$val) {
  42. if(!in_array($key, $global)) {
  43. if(is_array($val)) unset_array($GLOBALS[$key]);
  44. else unset($GLOBALS[$key]);
  45. }
  46. }
  47. }
  48. function unset_array($array) {
  49. foreach($array as $key) {
  50. if(is_array($key)) unset_array($key);
  51. else unset($key);
  52. }
  53. }
  54. globalskiller();
  55. if(isset($_GET['site'])) $site=$_GET['site'];
  56. else $site= null;
  57. if($site!="search") {
  58. $request=strtolower(urldecode($_SERVER['QUERY_STRING']));
  59. $protarray=array("union","select","into","where","update ","from","/*","set ",PREFIX."user ",PREFIX."user(",PREFIX."user`",PREFIX."user_groups","phpinfo",
  60. "escapeshellarg","exec","fopen","fwrite","escapeshellcmd","passthru","proc_close","proc_get_status","proc_nice",
  61. "proc_open","proc_terminate","shell_exec","system","telnet","ssh","cmd","mv","chmod","chdir","locate","killall",
  62. "passwd","kill","script","bash","perl","mysql","~root",".history","~nobody","getenv"
  63. );
  64. $check=str_replace($protarray, '*', $request);
  65. if($request != $check) system_error("Invalid request detected.");
  66. }
  67. function security_slashes(&$array) {
  68. foreach($array as $key => $value) {
  69. if(is_array($array[$key])) {
  70. security_slashes($array[$key]);
  71. }
  72. else {
  73. if(get_magic_quotes_gpc()) {
  74. $tmp = stripslashes($value);
  75. }
  76. else {
  77. $tmp = $value;
  78. }
  79. if(function_exists("mysql_real_escape_string")) {
  80. $array[$key] = mysql_real_escape_string($tmp);
  81. }
  82. else {
  83. $array[$key] = addslashes($tmp);
  84. }
  85. unset($tmp);
  86. }
  87. }
  88. }
  89. security_slashes($_POST);
  90. security_slashes($_COOKIE);
  91. security_slashes($_GET);
  92. // -- MYSQL QUERY FUNCTION -- //
  93. $_mysql_querys = array();
  94. function safe_query($query="") {
  95. if(stristr(str_replace(' ', '', $query), "unionselect")===FALSE AND stristr(str_replace(' ', '', $query), "union(select")===FALSE){
  96. if(empty($query)) return false;
  97. if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!');
  98. else {
  99. $result = mysql_query($query) or die('Query failed: '
  100. .'<li>errorno='.mysql_errno()
  101. .'<li>error='.mysql_error()
  102. .'<li>query='.$query);
  103. }
  104. return $result;
  105. }
  106. else die();
  107. }
  108. // -- SYSTEM ERROR DISPLAY -- //
  109. function system_error($text,$system=1) {
  110. if($system) {
  111. include('version.php');
  112. $info='webSPELL Version: '.$version.'<br />PHP Version: '.phpversion().'<br />MySQL Version: '.mysql_get_server_info().'<br />';
  113. } else {
  114. $info = '';
  115. }
  116. die('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  117. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  118. <head>
  119. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  120. <meta name="description" content="Clanpage using webSPELL 4 CMS" />
  121. <meta name="author" content="webspell.org" />
  122. <meta name="keywords" content="webspell, webspell4, clan, cms" />
  123. <meta name="copyright" content="Copyright &copy; 2005 - 2009 by webspell.org" />
  124. <meta name="generator" content="webSPELL" />
  125. <title>webSPELL</title>
  126. </head>
  127. <body>
  128. <center>
  129. <table border="0" cellpadding="1" cellspacing="1" bgcolor="#eeeeee">
  130. <tr>
  131. <td><a href="http://www.webspell.org" target="_blank"><img src="images/banner.gif" style="border:none;" alt="webSPELL.org" title="webSPELL.org" /></a></td>
  132. </tr>
  133. <tr bgcolor="#ffffff">
  134. <td><div style="color:#333333;font-family:Tahoma,Verdana,Arial;font-size:11px;padding:5px;">'.$info.'<br /><font color="red">'.$text.'</font><br />&nbsp;</div></td>
  135. </tr>
  136. <tr bgcolor="#ffffff">
  137. <td><div style="color:#333333;font-family:Tahoma,Verdana,Arial;font-size:11px;padding:5px;">For support visit <a href="http://webspell.org" target="_blank">webspell.org</a></div></td>
  138. </tr>
  139. </table>
  140. </center>
  141. </body>
  142. </html>');
  143. }
  144. // -- SYSTEM FILE INCLUDE -- //
  145. function systeminc($file) {
  146. if(!include('src/'.$file.'.php')) system_error('Could not get system file for '.$file);
  147. }
  148. // -- IGNORED USERS -- //
  149. function isignored($userID, $buddy) {
  150. $anz=mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID' "));
  151. if($anz) {
  152. $ergebnis=safe_query("SELECT * FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID' ");
  153. $ds=mysql_fetch_array($ergebnis);
  154. if($ds['banned']==1) return 1;
  155. else return 0;
  156. }
  157. else return 0;
  158. }
  159. // -- GLOBAL SETTINGS -- //
  160. $ds = mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."settings"));
  161. $maxshownnews = $ds['news']; if(empty($maxshownnews)) $maxshownnews = 10;
  162. $maxnewsarchiv = $ds['newsarchiv']; if(empty($maxnewsarchiv)) $maxnewsarchiv = 20;
  163. $maxheadlines = $ds['headlines']; if(empty($maxheadlines)) $maxheadlines = 10;
  164. $maxheadlinechars = $ds['headlineschars']; if(empty($maxheadlinechars)) $maxheadlinechars = 18;
  165. $maxtopnewschars = $ds['topnewschars']; if(empty($maxtopnewschars)) $maxtopnewschars = 200;
  166. $maxarticles = $ds['articles']; if(empty($maxarticles)) $maxarticles = 20;
  167. $latestarticles = $ds['latestarticles']; if(empty($latestarticles)) $latestarticles = 5;
  168. $articleschars = $ds['articleschars']; if(empty($articleschars)) $articleschars = 18;
  169. $maxclanwars = $ds['clanwars']; if(empty($maxclanwars)) $maxclanwars = 20;
  170. $maxresults = $ds['results']; if(empty($maxresults)) $maxresults = 5;
  171. $maxupcoming = $ds['upcoming']; if(empty($maxupcoming)) $maxupcoming = 5;
  172. $maxguestbook = $ds['guestbook']; if(empty($maxguestbook)) $maxguestbook = 20;
  173. $maxshoutbox = $ds['shoutbox']; if(empty($maxshoutbox)) $maxshoutbox = 5;
  174. $maxsball = $ds['sball']; if(empty($latestarticles)) $latestarticles = 5;
  175. $sbrefresh = $ds['sbrefresh']; if(empty($sbrefresh)) $sbrefresh = 60;
  176. $maxtopics = $ds['topics']; if(empty($maxtopics)) $maxtopics = 20;
  177. $maxposts = $ds['posts']; if(empty($maxposts)) $maxposts = 10;
  178. $maxlatesttopics = $ds['latesttopics']; if(empty($maxlatesttopics)) $maxlatesttopics = 10;
  179. $maxlatesttopicchars = $ds['latesttopicchars']; if(empty($maxlatesttopicchars)) $maxlatesttopicchars = 18;
  180. $maxfeedback = $ds['feedback']; if(empty($maxfeedback)) $maxfeedback = 5;
  181. $maxmessages = $ds['messages']; if(empty($maxmessages)) $maxmessages = 5;
  182. $maxusers = $ds['users']; if(empty($maxusers)) $maxusers = 5;
  183. $hp_url = $ds['hpurl'];
  184. $admin_name = $ds['adminname'];
  185. $admin_email = $ds['adminemail'];
  186. $myclantag = $ds['clantag'];
  187. $myclanname = $ds['clanname'];
  188. $maxarticles = $ds['articles']; if(empty($maxarticles)) $maxarticles = 5;
  189. $maxawards = $ds['awards']; if(empty($maxawards)) $maxawards = 20;
  190. $maxdemos = $ds['demos']; if(empty($maxdemos)) $maxdemos = 20;
  191. $profilelast = $ds['profilelast']; if(empty($profilelast)) $profilelast = 20;
  192. $topnewsID = $ds['topnewsID'];
  193. $sessionduration = $ds['sessionduration']; if(empty($sessionduration)) $sessionduration = 24;
  194. $closed = (int)$ds['closed'];
  195. $gb_info = $ds['gb_info'];
  196. $imprint_type = $ds['imprint'];
  197. $picsize_l = $ds['picsize_l']; if(empty($picsize_l)) $picsize_l = 9999;
  198. $picsize_h = $ds['picsize_h']; if(empty($picsize_h)) $picsize_h = 9999;
  199. $gallerypictures = $ds['pictures'];
  200. $publicadmin = $ds['publicadmin'];
  201. $thumbwidth = $ds['thumbwidth']; if(empty($thumbwidth)) $thumbwidth = 120;
  202. $usergalleries = $ds['usergalleries'];
  203. $maxusergalleries = $ds['maxusergalleries'];
  204. $default_language = $ds['default_language']; if(empty($default_language)) $default_language = 'uk';
  205. $rss_default_language = $ds['default_language']; if(empty($rss_default_language)) $rss_default_language = 'uk';
  206. $search_min_len = $ds['search_min_len']; if(empty($search_min_len)) $search_min_len = '4';
  207. $autoresize = $ds['autoresize']; if(empty($autoresize)) $autoresize = 2;
  208. $max_wrong_pw = $ds['max_wrong_pw']; if(empty($max_wrong_pw)) $max_wrong_pw = 3;
  209. $lastBanCheck = $ds['bancheck'];
  210. $insertlinks = $ds['insertlinks'];
  211. $new_chmod = 0666;
  212. $allow_usermovies=1; // 1= users are allowed to add videos; 0= no usermovies allowed
  213. $admin_activation=1; // 1= admin activasion enabled; 2= admin activasion disabled
  214. // -- STYLES -- //
  215. $ergebnis=safe_query("SELECT * FROM ".PREFIX."styles");
  216. $ds=mysql_fetch_array($ergebnis);
  217. define('PAGEBG', $ds['bgpage']);
  218. define('BORDER', $ds['border']);
  219. define('BGHEAD', $ds['bghead']);
  220. define('BGCAT', $ds['bgcat']);
  221. define('BG_1', $ds['bg1']);
  222. define('BG_2', $ds['bg2']);
  223. define('BG_3', $ds['bg3']);
  224. define('BG_4', $ds['bg4']);
  225. $hp_title = stripslashes($ds['title']);
  226. $pagebg = PAGEBG;
  227. $border = BORDER;
  228. $bghead = BGHEAD;
  229. $bgcat = BGCAT;
  230. $wincolor = $ds['win'];
  231. $loosecolor = $ds['loose'];
  232. $drawcolor = $ds['draw'];
  233. ?>