Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.php.default 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <?php
  2. // Require HTTPS //
  3. if($_SERVER["HTTPS"] != "on") {
  4. header("HTTP/1.1 301 Moved Permanently");
  5. header("Location: https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
  6. exit();
  7. }
  8. ini_set('session.cookie_domain', substr($_SERVER['SERVER_NAME'],strpos($_SERVER['SERVER_NAME'],"."),100));
  9. //require_once('classes/rcon.class.php');
  10. require_once('classes/resize.class.php');
  11. require_once('classes/Cryptography.class.php');
  12. require_once('classes/Tokenizer.class.php');
  13. require_once('common.php');
  14. require_once('classes/User.class.php');
  15. require_once('classes/UserTools.class.php');
  16. require_once('classes/DB.class.php');
  17. require_once('Minifier.php');
  18. $CONF=array();
  19. // Determines whether the current website is the development server or not
  20. $CONF['dev_env'] = FALSE;
  21. // Database Information
  22. $CONF['db_name'] = 'name';
  23. $CONF['db_user'] = 'user';
  24. $CONF['db_pass'] = 'pass';
  25. $CONF['db_host'] = 'localhost';
  26. $CONF['db_software'] = 'mysql';
  27. $CONF['mail_admin_user'] = 'user';
  28. $CONF['mail_admin_pass'] = 'password';
  29. // Site Title
  30. $CONF['sitetitle'] = 'Example Site';
  31. // Site Description
  32. $CONF['sitedescription'] = 'The best example site ever.';
  33. // Site Owner
  34. $CONF['siteowner'] = "Example Owner";
  35. // Site Host
  36. $CONF['host'] = 'example.com';
  37. // Default Page - The page used for the www and default site.
  38. $CONF['default_page'] = 'home';
  39. // The method to use for generating the url's for the site
  40. // --OPTIONS--
  41. // sub => Each service is a subdomain. ie: /about/ is about.$CONF['host']
  42. // page => Each service is a page in the url. ie: /about/ is $CONF['host']/about/
  43. $CONF['url_type'] = 'sub';
  44. // Internal Variable for whether the user is using https or not
  45. $CONF['https'] = $_SERVER['HTTPS'];
  46. // What is the name of the template you want to use for the frontend (the folder name as displayed in /templates/)
  47. $CONF['template'] = 'default';
  48. // The default theme for users
  49. $CONF['theme'] = 'default';
  50. // The available themes for users to choose from (Bootstrap CSS files)
  51. $CONF['themes']=array(
  52. 'default'=>'Default',
  53. 'darkly'=>'Darkly',
  54. 'flatly'=>'Flatly',
  55. 'lumen'=>'Lumen',
  56. 'paper'=>'Paper',
  57. 'sandstone'=>'Sandstone',
  58. 'simplex'=>'Simplex',
  59. 'superhero'=>'Superhero'
  60. );
  61. // Current Page
  62. $cur_page = '';
  63. switch ($CONF['url_type'])
  64. {
  65. case 'sub':
  66. $cur_page = get_subdomain();
  67. break;
  68. case 'page':
  69. $cur_page = get_page();
  70. break;
  71. }
  72. $CONF['page'] = $cur_page;
  73. $CONF['salt'] = "aaaaaaaaaaaa";
  74. $CONF['salt_2'] = hash("sha256","bbbbbbbb");
  75. $CONF['mod_rewrite'] = true;
  76. $CONF['key'] = "cccccccccc";
  77. $CONF['cipher'] = 'AES';
  78. // Donation Info
  79. $CONF['bitcoin_address'] = "myaddress";
  80. $CONF['dogecoin_address'] = "myaddress";
  81. // Upload Info
  82. $CONF['upload_dir'] = 'C:\\Upload\\Dir\\';
  83. $CONF['max_upload_size'] = 100; // In MB
  84. // Git Info
  85. $CONF['git_path'] = 'C:\\Git\\bin\\git.exe';
  86. $CONF['git_repo_path'] = array('C:\\Repositories\\Dir\\');
  87. $CONF['gitolite_path'] = '/cygwin/bin/gitolite/';
  88. $CONF['git_key_dir'] = 'C:\\cygwin\\var\\keys';
  89. $CONF['git_user'] = "gituser";
  90. $CONF['git_pass'] = "password";
  91. $CONF['ssh_pub_keys'] = "C:\\Users\\user\\.ssh\\authorized_keys";
  92. $CONF['forced_commands'] = "no-port-forwarding,no-agent-forwarding,command=\"./gitserv\"";
  93. // IRC Info
  94. $CONF['irc_network'] = "irc.server.net";
  95. $CONF['irc_port'] = 6667;
  96. $CONF['irc_nick'] = "Bot";
  97. $CONF['irc_realname'] = "IRC Bot Name";
  98. $CONF['irc_pass'] = "password";
  99. $CONF['irc_channel'] = "#channel";
  100. // SMTP Info
  101. $CONF['smpt_host'] = "mail.example.com";
  102. $CONF['smpt_user'] = "no-reply";
  103. $CONF['smpt_pass'] = "password";
  104. // Minecraft Info
  105. $CONF['minecraft_server'] = "minecraft.".$CONF['host'];
  106. $CONF['rcon_port'] = 25575;
  107. $CONF['rcon_pass'] = "password";
  108. // Blog Info
  109. $CONF['blog_author'] = "Example";
  110. $CONF['blog_title'] = "Example Blog";
  111. $CONF['blog_desc'] = "Example Description";
  112. $CONF['blog_posts_per_page'] = 10;
  113. // Podcast Info
  114. $CONF['podcast_author'] = "Example";
  115. $CONF['podcast_title'] = "Example Podcast";
  116. $CONF['podcast_desc'] = "";
  117. $CONF['podcasts_per_page'] = 10;
  118. $CONF['podcast_dir'] = 'C:\\Podcasts\\';
  119. /*
  120. *
  121. * Paste Configuration Options
  122. *
  123. */
  124. $CONF['pid_format'] = '%d';
  125. // Default expiry time - d (day), m (month), and f (forever).
  126. $CONF['default_expiry'] = 'f';
  127. // The maximum number of posts you want to keep. Keep this as-is if you want no limits.
  128. $CONF['max_posts'] = 0;
  129. // Default syntax highlight for pastes.
  130. $CONF['default_highlighter'] = 'text';
  131. // Available formats (All GeSHi formats are here)
  132. $CONF['geshiformats']=array(
  133. 'abap'=>'ABAP',
  134. 'actionscript'=>'ActionScript',
  135. 'actionscript3'=>'ActionScript 3',
  136. 'ada'=>'Ada',
  137. 'apache'=>'Apache',
  138. 'applescript'=>'AppleScript',
  139. 'apt_sources'=>'Apt sources.list',
  140. 'asm'=>'ASM',
  141. 'asp'=>'ASP',
  142. 'autoit'=>'AutoIt',
  143. 'avisynth'=>'AviSynth',
  144. 'bash'=>'BASH',
  145. 'basic4gl'=>'Basic4GL',
  146. 'bf'=>'Brainfuck',
  147. 'bibtex'=>'BibTeX',
  148. 'blitzbasic'=>'BlitzBasic',
  149. 'bnf'=>'BNF',
  150. 'boo'=>'Boo',
  151. 'c'=>'C',
  152. 'c_mac'=>'C for Macs',
  153. 'caddcl'=>'CADDCL',
  154. 'cadlisp'=>'CADLisp',
  155. 'cfdg'=>'CFDG',
  156. 'cfm'=>'ColdFusion',
  157. 'cil'=>'CIL',
  158. 'cmake'=>'CMake',
  159. 'cobol'=>'COBOL',
  160. 'cpp-qt'=>'C++ (with QT extensions)',
  161. 'cpp'=>'C++',
  162. 'csharp'=>'C#',
  163. 'css'=>'CSS',
  164. 'd'=>'D',
  165. 'dcs'=>'DCS',
  166. 'delphi'=>'Delphi',
  167. 'diff'=>'Diff-output',
  168. 'div'=>'DIV',
  169. 'dos'=>'DOS',
  170. 'dot'=>'dot',
  171. 'eiffel'=>'Eiffel',
  172. 'email'=>'E-mail (mbox\eml\RFC format)',
  173. 'erlang'=>'Erlang',
  174. 'fo'=>'FO',
  175. 'fortran'=>'Fortran',
  176. 'freebasic'=>'FreeBasic',
  177. 'genero'=>'Genero',
  178. 'gettext'=>'GNU Gettext .po/.pot',
  179. 'glsl'=>'glSlang',
  180. 'gml'=>'GML',
  181. 'gnuplot'=>'GNUPlot',
  182. 'groovy'=>'Groovy',
  183. 'haskell'=>'Haskell',
  184. 'hq9plus'=>'HQ9+',
  185. 'html4strict'=>'HTML 4.01 strict',
  186. 'idl'=>'Unoidl',
  187. 'ini'=>'INI',
  188. 'inno'=>'Inno Script',
  189. 'intercal'=>'INTERCAL',
  190. 'io'=>'IO',
  191. 'java'=>'Java',
  192. 'java5'=>'Java 5',
  193. 'javascript'=>'JavaScript',
  194. 'kixtart'=>'KiXtart',
  195. 'klonec'=>'KLone with C',
  196. 'klonecpp'=>'KLone with C++',
  197. 'latex'=>'LaTeX',
  198. 'lisp'=>'Generic Lisp',
  199. 'locobasic'=>'Locomotive Basic',
  200. 'lolcode'=>'LOLcode',
  201. 'lotusformulas'=>'@Formula/@Command',
  202. 'lotusscript'=>'LotusScript',
  203. 'lscript'=>'Lightwave Script',
  204. 'lsl2'=>'Linden Script',
  205. 'lua'=>'LUA',
  206. 'm68k'=>'Motorola 68000 Assembler',
  207. 'make'=>'GNU make',
  208. 'matlab'=>'Matlab',
  209. 'mirc'=>'mIRC',
  210. 'modula3'=>'Modula-3',
  211. 'mpasm'=>'Microchip Assembler',
  212. 'mxml'=>'MXML',
  213. 'mysql'=>'MySQL',
  214. 'nsis'=>'NSIS',
  215. 'oberon2'=>'Oberon-2',
  216. 'objc'=>'Objective-C',
  217. 'ocaml-brief'=>'Objective Caml',
  218. 'oobas'=>'OOo Basic',
  219. 'oracle11'=>'Oracle 11i',
  220. 'oracle8'=>'Oracle 8',
  221. 'pascal'=>'Pascal',
  222. 'per'=>'Per (forms)',
  223. 'perl'=>'Perl',
  224. 'php-brief'=>'PHP (Brief version)',
  225. 'php'=>'PHP',
  226. 'pic16'=>'PIC16 Assembler',
  227. 'pixelbender'=>'Pixel Bender',
  228. 'text'=>'Plain text',
  229. 'plsql'=>'Oracle 9.2 PL/SQL',
  230. 'povray'=>'Povray',
  231. 'powershell'=>'PowerShell',
  232. 'progress'=>'Progress',
  233. 'prolog'=>'Prolog',
  234. 'properties'=>'Property',
  235. 'providex'=>'ProvideX',
  236. 'python'=>'Python',
  237. 'qbasic'=>'QuickBASIC',
  238. 'rails'=>'Ruby on Rails',
  239. 'rebol'=>'Rebol',
  240. 'reg'=>'Microsoft REGEDIT',
  241. 'robots'=>'Robots.txt',
  242. 'ruby'=>'Ruby',
  243. 'sas'=>'SAS',
  244. 'scala'=>'Scala',
  245. 'scheme'=>'Scheme',
  246. 'scilab'=>'SciLab',
  247. 'sdlbasic'=>'sdlBasic',
  248. 'smalltalk'=>'Smalltalk',
  249. 'smarty'=>'Smarty',
  250. 'sql'=>'SQL',
  251. 'tcl'=>'TCL',
  252. 'teraterm'=>'Tera Term Macro',
  253. 'thinbasic'=>'thinBasic',
  254. 'tsql'=>'T-SQL',
  255. 'typoscript'=>'TypoScript',
  256. 'vb'=>'Visual Basic',
  257. 'vbnet'=>'Visual Basic .NET',
  258. 'verilog'=>'Verilog',
  259. 'vhdl'=>'VHDL',
  260. 'vim'=>'Vim',
  261. 'visualfoxpro'=>'Visual FoxPro',
  262. 'visualprolog'=>'Visual Prolog',
  263. 'whitespace'=>'Whitespace',
  264. 'whois'=>'WHOIS (RPSL format)',
  265. 'winbatch'=>'WinBatch',
  266. 'xml'=>'XML',
  267. 'xorg_conf'=>'xorg.conf',
  268. 'xpp'=>'Axapta/Dynamics Ax X++',
  269. 'z80'=>'ZiLOG Z80 Assembler',
  270. );
  271. // The formats that are listed first.
  272. $CONF['popular_formats'] = array(
  273. 'text','bash','html4strict', 'css', 'javascript', 'php',
  274. 'perl','python','sql','ruby', 'rails', 'tcl', 'xml',
  275. 'whois','xorg_conf','java','apt_sources','mirc','c','cpp',
  276. );
  277. $CONF['highlight_prefix'] = '!highlight!';
  278. $CONF['errors'] = array(
  279. 'NoErr' => array('code' => 0, 'message' => 'No Error'),
  280. 'InvRequest' => array('code' => 1, 'message' => 'Invalid Request'),
  281. 'InvFile' => array('code' => 10, 'message' => 'Invalid File'),
  282. 'NoFile' => array('code' => 11, 'message' => 'No File Provided'),
  283. 'InvPaste' => array('code' => 20, 'message' => 'Invalid Paste Information'),
  284. 'NoPaste' => array('code' => 21, 'message' => 'No Paste Information Provided'),
  285. 'NoImages' => array('code' => 31, 'message' => 'No Image Results'),
  286. 'NoUser' => array('code' => 40, 'message' => 'No Username Specified'),
  287. 'NoPass' => array('code' => 41, 'message' => 'No Password Specified'),
  288. 'InvCred' => array('code' => 42, 'message' => 'Invalid Username/Password'),
  289. 'NoLogin' => array('code' => 43, 'message' => 'Must be Logged In'),
  290. 'NoAuth' => array('code' => 44, 'message' => 'Not Authorized')
  291. );
  292. $CONF['session_prefix'] = '';
  293. if ($CONF['dev_env'])
  294. {
  295. $CONF['session_prefix'] = 'dev_';
  296. }
  297. /*
  298. Class initilization
  299. */
  300. $db = new DB();
  301. $db->connect($CONF);
  302. //initialize UserTools object
  303. $userTools = new UserTools($db, $CONF);
  304. $mod_rewrite=true;
  305. //Purge Sessions table of any old sessions
  306. $db->delete("sessions", "timeout < ?", array(date("Y-m-d H:i:s",time())));
  307. //Set the site's cookie domain
  308. ini_set('session.cookie_domain', '.'.$CONF['host']);
  309. //start the session
  310. session_start();
  311. //Set session if cookie present and valid
  312. if (isset($_COOKIE[$CONF['session_prefix'].'auth']))
  313. {
  314. list($identifier, $token) = explode(':', $_COOKIE['auth']);
  315. $result = $db->select("sessions", "identifier=? AND token=?", array($identifier, $token));
  316. if(isset($result['user_id']))
  317. {
  318. $_SESSION[$CONF['session_prefix'].'user'] = serialize($userTools->get($result['user_id']));
  319. $_SESSION[$CONF['session_prefix'].'logged_in'] = 1;
  320. }
  321. }
  322. //refresh session variables if logged in
  323. if (isset($_SESSION[$CONF['session_prefix'].'logged_in']))
  324. {
  325. if ($_SESSION[$CONF['session_prefix'].'logged_in'] == 1)
  326. {
  327. $user = unserialize($_SESSION[$CONF['session_prefix'].'user']);
  328. $_SESSION[$CONF['session_prefix'].'user'] = serialize($userTools->get($user->id));
  329. $logged_in = true;
  330. }
  331. else
  332. {
  333. $logged_in = false;
  334. }
  335. }
  336. // Set user specific config
  337. if ($logged_in)
  338. {
  339. $CONF['theme'] = $user->theme;
  340. }
  341. ?>