PageRenderTime 1489ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/hosting_project/ws_versions/ws1/_settings.php

https://github.com/WeMake-IT/Hosting-Service
PHP | 323 lines | 32 code | 17 blank | 274 comment | 8 complexity | 851163bce04e0153d522a5b5f4f5bcd2 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-2010 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. # #
  28. # Version 4 / / / #
  29. # -----------__---/__---__------__----__---/---/- #
  30. # | /| / /___) / ) (_ ` / ) /___) / / #
  31. # _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ #
  32. # Society / Edition #
  33. # / #
  34. # #
  35. # modified by webspell|k3rmit (Stefan Giesecke) in 2009 #
  36. # #
  37. # - Modifications are released under the GNU GENERAL PUBLIC LICENSE #
  38. # - It is NOT allowed to remove this copyright-tag #
  39. # - http://www.fsf.org/licensing/licenses/gpl.html #
  40. # #
  41. ##########################################################################
  42. */
  43. ini_set('session.use_trans_sid', 0);
  44. ini_set('session.use_cookies', 1);
  45. ini_set('session.use_only_cookie', 1);
  46. // -- ERROR REPORTING -- //
  47. define('DEBUG', "OFF");
  48. error_reporting(0); // 0 = public mode, E_ALL = development-mode
  49. // -- SET ENCODING FOR MB-FUNCTIONS -- //
  50. mb_internal_encoding("UTF-8");
  51. // -- SET ENCODING
  52. header('content-type: text/html; charset=utf-8');
  53. // -- CONNECTION TO MYSQL -- //
  54. mysql_connect($host, $user, $pwd) or system_error('ERROR: Can not connect to MySQL-Server');
  55. mysql_select_db($db) or system_error('ERROR: Can not connect to database "'.$db.'"');
  56. mysql_query("SET NAMES 'utf8'");
  57. // -- GENERAL PROTECTIONS -- //
  58. function globalskiller() { // kills all non-system variables
  59. $global = array('GLOBALS', '_POST', '_GET', '_COOKIE', '_FILES', '_SERVER', '_ENV', '_REQUEST', '_SESSION');
  60. foreach ($GLOBALS as $key=>$val) {
  61. if(!in_array($key, $global)) {
  62. if(is_array($val)) unset_array($GLOBALS[$key]);
  63. else unset($GLOBALS[$key]);
  64. }
  65. }
  66. }
  67. function unset_array($array) {
  68. foreach($array as $key) {
  69. if(is_array($key)) unset_array($key);
  70. else unset($key);
  71. }
  72. }
  73. globalskiller();
  74. if(isset($_GET['site'])) $site=$_GET['site'];
  75. else $site= null;
  76. if($site!="search") {
  77. $request=strtolower(urldecode($_SERVER['QUERY_STRING']));
  78. $protarray=array("union","select","into","where","update ","from","/*","set ",PREFIX."user ",PREFIX."user(",PREFIX."user`",PREFIX."user_groups","phpinfo",
  79. "escapeshellarg","exec","fopen","fwrite","escapeshellcmd","passthru","proc_close","proc_get_status","proc_nice",
  80. "proc_open","proc_terminate","shell_exec","system","telnet","ssh","cmd","mv","chmod","chdir","locate","killall",
  81. "passwd","kill","script","bash","perl","mysql","~root",".history","~nobody","getenv"
  82. );
  83. $check=str_replace($protarray, '*', $request);
  84. if($request != $check) system_error("Invalid request detected.");
  85. }
  86. function security_slashes(&$array) {
  87. foreach($array as $key => $value) {
  88. if(is_array($array[$key])) {
  89. security_slashes($array[$key]);
  90. }
  91. else {
  92. if(get_magic_quotes_gpc()) {
  93. $tmp = stripslashes($value);
  94. }
  95. else {
  96. $tmp = $value;
  97. }
  98. if(function_exists("mysql_real_escape_string")) {
  99. $array[$key] = mysql_real_escape_string($tmp);
  100. }
  101. else {
  102. $array[$key] = addslashes($tmp);
  103. }
  104. unset($tmp);
  105. }
  106. }
  107. }
  108. security_slashes($_POST);
  109. security_slashes($_COOKIE);
  110. security_slashes($_GET);
  111. security_slashes($_REQUEST);
  112. // -- MYSQL QUERY FUNCTION -- //
  113. $_mysql_querys = array();
  114. function safe_query($query="") {
  115. if(stristr(str_replace(' ', '', $query), "unionselect")===FALSE AND stristr(str_replace(' ', '', $query), "union(select")===FALSE){
  116. if(empty($query)) return false;
  117. if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!');
  118. else {
  119. $result = mysql_query($query) or die('Query failed: '
  120. .'<li>errorno='.mysql_errno()
  121. .'<li>error='.mysql_error()
  122. .'<li>query='.$query);
  123. }
  124. return $result;
  125. }
  126. else die();
  127. }
  128. // -- SYSTEM ERROR DISPLAY -- //
  129. function system_error($text,$system=1) {
  130. if($system) {
  131. include('version.php');
  132. $info='webSPELL Version: '.$version.'<br />PHP Version: '.phpversion().'<br />MySQL Version: '.mysql_get_server_info().'<br />';
  133. } else {
  134. $info = '';
  135. }
  136. die('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  137. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  138. <head>
  139. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  140. <meta name="description" content="Website using webSPELL 4 CMS - Society Edition" />
  141. <meta name="author" content="webspell.org" />
  142. <meta name="keywords" content="webspell, webspell4, cms, society, edition" />
  143. <meta name="copyright" content="Copyright &copy; 2005 - 2009 by webspell.org" />
  144. <meta name="generator" content="webSPELL" />
  145. <title>webSPELL</title>
  146. </head>
  147. <body>
  148. <center>
  149. <table border="0" cellpadding="1" cellspacing="1" bgcolor="#eeeeee">
  150. <tr>
  151. <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>
  152. </tr>
  153. <tr bgcolor="#ffffff">
  154. <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>
  155. </tr>
  156. <tr bgcolor="#ffffff">
  157. <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>
  158. </tr>
  159. </table>
  160. </center>
  161. </body>
  162. </html>');
  163. }
  164. // -- BOX MODULES INCLUDE -- //
  165. function boxinclude($placeholder){
  166. global $index_language, $_language, $latestarticles, $userID, $maxlatesttopics, $border, $maxlatesttopicchars, $maxposts, $loggedin, $topnewsID, $maxheadlines, $maxtopnewschars, $maxheadlinechars, $maxresults, $maxupcoming, $sbrefresh, $bg1, $useraccessgroups;
  167. $_language_box = new Language;
  168. $_language_box->set_language($_language->language);
  169. $_language_box->db_read_module('boxmodule');
  170. $result=safe_query("SELECT modules_boxedID, filename, placeholder, activated, access FROM ".PREFIX."modules_boxed WHERE placeholder=".$placeholder);
  171. $any=mysql_num_rows($result);
  172. if($any){ //box module definition is available
  173. $row=mysql_fetch_array($result);
  174. if($row['activated']==1){ //module is activated
  175. if(file_exists($row['filename'])){ //given file in box module definition exists
  176. if(hasaccess($row['access'], $useraccessgroups)){
  177. $boxmodulename=$_language_box->module[$row['modules_boxedID']];
  178. eval("\$boxmodule_head = \"".gettemplate("boxmodule_head")."\";");
  179. echo $boxmodule_head;
  180. include($row['filename']);
  181. eval("\$boxmodule_foot = \"".gettemplate("boxmodule_foot")."\";");
  182. echo $boxmodule_foot;
  183. }
  184. }
  185. else{ //given file in box module definition does not exist
  186. echo $index_language['modbox_not_available'];
  187. eval("\$boxmodule_foot = \"".gettemplate("boxmodule_foot")."\";");
  188. echo $boxmodule_foot;
  189. }
  190. }
  191. else{ //module is not activated
  192. }
  193. }
  194. else{ //box module definition is not available
  195. }
  196. }
  197. // -- SYSTEM FILE INCLUDE -- //
  198. function systeminc($file) {
  199. if(!include('src/'.$file.'.php')) system_error('Could not get system file for '.$file);
  200. }
  201. // -- IGNORED USERS -- //
  202. function isignored($userID, $buddy) {
  203. $anz=mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID' "));
  204. if($anz) {
  205. $ergebnis=safe_query("SELECT * FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID' ");
  206. $ds=mysql_fetch_array($ergebnis);
  207. if($ds['banned']==1) return 1;
  208. else return 0;
  209. }
  210. else return 0;
  211. }
  212. // -- GLOBAL SETTINGS -- //
  213. $ds = mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."settings"));
  214. $maxshownnews = $ds['news']; if(empty($maxshownnews)) $maxshownnews = 10;
  215. $maxnewsarchiv = $ds['newsarchiv']; if(empty($maxnewsarchiv)) $maxnewsarchiv = 20;
  216. $maxheadlines = $ds['headlines']; if(empty($maxheadlines)) $maxheadlines = 10;
  217. $maxheadlinechars = $ds['headlineschars']; if(empty($maxheadlinechars)) $maxheadlinechars = 18;
  218. $maxtopnewschars = $ds['topnewschars']; if(empty($maxtopnewschars)) $maxtopnewschars = 200;
  219. $maxarticles = $ds['articles']; if(empty($maxarticles)) $maxarticles = 20;
  220. $latestarticles = $ds['latestarticles']; if(empty($latestarticles)) $latestarticles = 5;
  221. $articleschars = $ds['articleschars']; if(empty($articleschars)) $articleschars = 18;
  222. $maxguestbook = $ds['guestbook']; if(empty($maxguestbook)) $maxguestbook = 20;
  223. $maxshoutbox = $ds['shoutbox']; if(empty($maxshoutbox)) $maxshoutbox = 5;
  224. $maxsball = $ds['sball']; if(empty($latestarticles)) $latestarticles = 5;
  225. $sbrefresh = $ds['sbrefresh']; if(empty($sbrefresh)) $sbrefresh = 60;
  226. $maxtopics = $ds['topics']; if(empty($maxtopics)) $maxtopics = 20;
  227. $maxposts = $ds['posts']; if(empty($maxposts)) $maxposts = 10;
  228. $maxlatesttopics = $ds['latesttopics']; if(empty($maxlatesttopics)) $maxlatesttopics = 10;
  229. $maxlatesttopicchars = $ds['latesttopicchars']; if(empty($maxlatesttopicchars)) $maxlatesttopicchars = 18;
  230. $maxfeedback = $ds['feedback']; if(empty($maxfeedback)) $maxfeedback = 5;
  231. $maxmessages = $ds['messages']; if(empty($maxmessages)) $maxmessages = 5;
  232. $maxusers = $ds['users']; if(empty($maxusers)) $maxusers = 5;
  233. $maxboxmodules = $ds['maxboxmodules'];
  234. $hp_url = $ds['hpurl'];
  235. $admin_name = $ds['adminname'];
  236. $admin_email = $ds['adminemail'];
  237. $myclantag = $ds['clantag'];
  238. $myclanname = $ds['clanname'];
  239. $maxarticles = $ds['articles']; if(empty($maxarticles)) $maxarticles = 5;
  240. $profilelast = $ds['profilelast']; if(empty($profilelast)) $profilelast = 20;
  241. $topnewsID = $ds['topnewsID'];
  242. $sessionduration = $ds['sessionduration']; if(empty($sessionduration)) $sessionduration = 24;
  243. $closed = (int)$ds['closed'];
  244. $gb_info = $ds['gb_info'];
  245. $imprint_type = $ds['imprint'];
  246. $picsize_l = $ds['picsize_l']; if(empty($picsize_l)) $picsize_l = 9999;
  247. $picsize_h = $ds['picsize_h']; if(empty($picsize_h)) $picsize_h = 9999;
  248. $gallerypictures = $ds['pictures'];
  249. $publicadmin = $ds['publicadmin'];
  250. $thumbwidth = $ds['thumbwidth']; if(empty($thumbwidth)) $thumbwidth = 120;
  251. $usergalleries = $ds['usergalleries'];
  252. $maxusergalleries = $ds['maxusergalleries'];
  253. $default_language = $ds['default_language']; if(empty($default_language)) $default_language = 'uk';
  254. $rss_default_language = $ds['default_language']; if(empty($rss_default_language)) $rss_default_language = 'uk';
  255. $search_min_len = $ds['search_min_len']; if(empty($search_min_len)) $search_min_len = '4';
  256. $autoresize = $ds['autoresize']; if(empty($autoresize)) $autoresize = 2;
  257. $max_wrong_pw = $ds['max_wrong_pw']; if(empty($max_wrong_pw)) $max_wrong_pw = 3;
  258. $lastBanCheck = $ds['bancheck'];
  259. $insertlinks = $ds['insertlinks'];
  260. $new_chmod = 0666;
  261. // -- STYLES -- //
  262. $ergebnis=safe_query("SELECT * FROM ".PREFIX."styles");
  263. $ds=mysql_fetch_array($ergebnis);
  264. define('PAGEBG', $ds['bgpage']);
  265. define('BORDER', $ds['border']);
  266. define('BGHEAD', $ds['bghead']);
  267. define('BGCAT', $ds['bgcat']);
  268. define('BG_1', $ds['bg1']);
  269. define('BG_2', $ds['bg2']);
  270. define('BG_3', $ds['bg3']);
  271. define('BG_4', $ds['bg4']);
  272. $hp_title = stripslashes($ds['title']);
  273. $pagebg = PAGEBG;
  274. $border = BORDER;
  275. $bghead = BGHEAD;
  276. $bgcat = BGCAT;
  277. $wincolor = $ds['win'];
  278. $loosecolor = $ds['loose'];
  279. $drawcolor = $ds['draw'];
  280. ?>