PageRenderTime 71ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 1ms

/test/subjects/benchmarks/webapps/tigerPhpNewsSystem_1.0_beta_build39/index.php

http://phc.googlecode.com/
PHP | 2777 lines | 2491 code | 105 blank | 181 comment | 861 complexity | f061bf620ef88c20976540361c106b8d MD5 | raw file
Possible License(s): GPL-2.0, 0BSD, BSD-3-Clause, Unlicense, MPL-2.0-no-copyleft-exception, LGPL-2.1
  1. <?
  2. /*
  3. * This software is part of the Tiger php news system
  4. * http://tpns.sourceforge.net
  5. *
  6. * This software comes with ABSOLUTELY NO WARRANTY. For details, see
  7. * the enclosed file COPYING for license information (GPL). If you
  8. * did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  9. *
  10. */
  11. //{{{ PHP start
  12. #start timer:
  13. $stimer = explode( ' ', microtime() );
  14. $stimer = $stimer[1] + $stimer[0];
  15. $isbot=false;
  16. if ( preg_match("/bot|spider|crawl|seek|search|slurp|checker|meta|validator/is",$_SERVER['HTTP_USER_AGENT'] ) )
  17. {
  18. $isbot=true;
  19. }
  20. header("Content-Type: text/html; charset=ISO-8859-15");
  21. require_once( 'Main.php' );
  22. include( 'config.php' );
  23. require_once( 'sessions.php' );
  24. $confnr=$nr;
  25. $main = new Main();
  26. #if ($usedbsessions)
  27. #{
  28. # $session = new session();
  29. # $session->setMain($main);
  30. # session_set_save_handler(array(&$session,"open"), array(&$session,"close"), array(&$session,"read"), array(&$session,"write"), array(&$session,"destroy"), array(&$session,"gc"));
  31. #}
  32. session_start();
  33. //{{{ LOG ANON COMMENTS
  34. if (isset($_REQUEST['page']) and $logannoncomment)
  35. {
  36. if ( !isset($_SESSION['role'])){$_SESSION['role']="0";}
  37. if ($_SESSION['role'] == "0" and $_REQUEST['page'] == "addnewscomment")
  38. {
  39. //open the file and append the contents
  40. $fp = fopen($annoncommentlogfile, "a+");
  41. // Write the request to the file
  42. fwrite($fp, "\n\nREMOTE_ADDR=".$_SERVER['REMOTE_ADDR']);
  43. fwrite($fp, "\nHTTP_HOST=".$_SERVER['HTTP_HOST']);
  44. fwrite($fp, "\nHTTP_USER_AGENT=".$_SERVER['HTTP_USER_AGENT']);
  45. fwrite($fp, "\nHTTP_ACCEPT=".$_SERVER['HTTP_ACCEPT']);
  46. fwrite($fp, "\nHTTP_ACCEPT_LANGUAGE=".$_SERVER['HTTP_ACCEPT_LANGUAGE']);
  47. fwrite($fp, "\nHTTP_ACCEPT_ENCODING=".$_SERVER['HTTP_ACCEPT_ENCODING']);
  48. fwrite($fp, "\nHTTP_ACCEPT_CHARSET=".$_SERVER['HTTP_ACCEPT_CHARSET']);
  49. foreach ($_GET as $key => $val) {fwrite($fp, "\n_GET: ".$key."=".$val);}
  50. foreach ($_POST as $key => $val) {fwrite($fp, "\n_POST: ".$key."=".$val);}
  51. foreach ($_SESSION as $key => $val) {fwrite($fp, "\n_SESSION: ".$key."=".$val);}
  52. foreach ($_COOKIE as $key => $val) { fwrite($fp, "\n_COOKIE: ".$key."=".$val);
  53. }
  54. fwrite($fp, "\n");
  55. // Close the file
  56. fclose($fp);
  57. }
  58. }
  59. //}}}
  60. $havecookie=false;
  61. if ( isset($_COOKIE['PHPSESSID']) and isset($_SESSION['reqid']) )
  62. {
  63. $havecookie=true;
  64. }
  65. $main->isbot=$isbot;
  66. $main->havecookie=$havecookie;
  67. $upload_max_filesize = ini_get('upload_max_filesize');
  68. $form_upload_max_filesize = preg_replace('/M/', '000000', $upload_max_filesize);
  69. $text_upload_max_filesize = preg_replace('/M/', ' Megabyte(s)', $upload_max_filesize);
  70. //$main->Main();
  71. $_REQUEST = $main->clean_array( $_REQUEST, true );
  72. $_SERVER = $main->clean_array( $_SERVER, false, false );
  73. if ( isset($_SESSION['nr']) ){$nr=$_SESSION['nr'];}
  74. if ( isset($_REQUEST['nr']) ){$nr=$_REQUEST['nr'];}
  75. $count=0;
  76. $plugins=array();
  77. //Variables
  78. $page="start";if ( $initpage == "true"){ $page="init";}if ($enablesplash){ $page="splash";}if ( isset($_REQUEST['page']) ){$page=$_REQUEST['page'];}
  79. $bbcode="
  80. <script type=\"text/javascript\">
  81. //<!--
  82. function showBBcodehelp()
  83. {
  84. var bbcodetext = document.getElementById('bbcodehelp');
  85. var bbon = document.getElementById('bbon');
  86. bbcodetext.style.display = \"block\";
  87. bbon.style.display = \"none\";
  88. }
  89. function hideBBcodehelp()
  90. {
  91. var bbcodetext = document.getElementById('bbcodehelp');
  92. var bbon = document.getElementById('bbon');
  93. bbcodetext.style.display = \"none\";
  94. bbon.style.display = \"block\";
  95. }
  96. //-->
  97. </script>
  98. <input type='button' value='bbcode' id='bbon' onclick=\"showBBcodehelp()\" class='button'/>
  99. <div id='bbcodehelp' style='display:none'>
  100. <input type='button' value='bbcode' id='bboff' onclick=\"hideBBcodehelp()\" class='button'/>
  101. <p><small>[b]<b>B</b>[/b] [i]<i>i</i>[/i] [u]<span class='uline'>u</span>[/u] [s]<span class=\"small\">s</span>[/s] [sm]<small>small</small>[/sm] [big]<big>big</big>[/big] [strike]<span class='strike'>strike</span>[/strike]<br />
  102. [color=#f00]<span style=\"color: #f00;\">#f00</span>[/color] [color=#f00000]<span style=\"color: #f00000;\">#f00000</span>[/color] [color=red]<span style=\"color: red;\">red</span>[/color]<br />
  103. [table]<br />[tr][th][/th][/tr]<br />[tr][td][/td][/tr]<br />[/table]<br />
  104. [list][list=1][list=a]<br />
  105. [*] <br />
  106. [/list]<br />
  107. [bq]<br />
  108. blockquote<br />
  109. [/bq]<br />
  110. [url=http://url]name[/url]<br />
  111. [url=mailto:address]name[/url]<br />
  112. [news=#]name[/news]<br />
  113. [page=page]name[/page]<br />
  114. [cat=#]name[/cat]<br />
  115. </small></p></div>";
  116. if ( $enablebbcode != "true" )
  117. {
  118. $bbcode="";
  119. }
  120. $main->setBBcode($bbcode);
  121. if (!isset($_SESSION['imgkey'])){$_SESSION['imgkey']=rand(1000, 9999);}
  122. if (!isset($_REQUEST['imgkey'])){$_REQUEST['imgkey']=0;}
  123. if (!isset($_SESSION['anonemail'])){$_SESSION['anonemail']="";}
  124. if (!isset($_SESSION['anonname'])){$_SESSION['anonname']="";}
  125. if (!isset($_SESSION['anonhomepage'])){$_SESSION['anonhomepage']="";}
  126. $oldrequestid=rand(1000, 9999);if ( isset($_REQUEST['rid'])){$oldrequestid=$_REQUEST['rid'];}else{$_REQUEST['rid']=$oldrequestid;}
  127. $requestid=rand(1000, 9999);;if ( isset($_SESSION['reqid']) ){$requestid=$_SESSION['reqid'];}
  128. //}}}
  129. // {{{ Counter
  130. if ( $enablecounter == "true" )
  131. {
  132. // Open the file for reading
  133. $fp = fopen("counterlog.txt", "r");
  134. // Get the existing count
  135. $count = fread($fp, 1024);
  136. // Close the file
  137. fclose($fp);
  138. if ($main->isPublicIp($_SERVER['REMOTE_ADDR']))
  139. {
  140. if ( !isset($_SESSION['counted']) and !$isbot and $havecookie )
  141. {
  142. $count=$count + 1;
  143. // Reopen the file and erase the contents
  144. $fp = fopen("counterlog.txt", "w");
  145. // Write the new count to the file
  146. fwrite($fp, $count);
  147. // Close the file
  148. fclose($fp);
  149. $_SESSION['counted'] = "1";
  150. }
  151. }
  152. }
  153. //}}} Counter
  154. //{{{ Check referer
  155. if ( isset($_SERVER['HTTP_REFERER']) )
  156. {
  157. if (! preg_match ("/http:\/\/".$_SERVER['HTTP_HOST']."/i", $_SERVER['HTTP_REFERER']))
  158. {
  159. $main->addreferer( $_SERVER['HTTP_REFERER'] );
  160. }
  161. }
  162. ///}}}
  163. //{{{ browser statistics
  164. if ( !isset($_SESSION['bstat']))
  165. {
  166. $testbrowsercap=ini_get("browscap");
  167. if ( $testbrowsercap != "")
  168. {
  169. if ($main->isPublicIp($_SERVER['REMOTE_ADDR']))
  170. {
  171. $browserinfo = get_browser();
  172. $bstatplatform="";if (isset($browserinfo->platform)){$bstatplatform=$browserinfo->platform;}
  173. $bstatbrowser="";if (isset($browserinfo->browser)){$bstatbrowser=$browserinfo->browser;}
  174. $bstatversion="";if (isset($browserinfo->version)){$bstatversion=$browserinfo->version;}
  175. $bstatcrawler=0;if ("$browserinfo->crawler" == "1" ){$bstatcrawler=$browserinfo->crawler;}
  176. if ("$bstatplatform$bstatbrowser$bstatversion" != "" )
  177. {
  178. $main->updatebrowserstat($bstatplatform,$bstatbrowser,$bstatversion,$bstatcrawler);
  179. }
  180. }
  181. }
  182. $_SESSION['bstat']="loged";
  183. }
  184. //}}}
  185. //{{{Login
  186. if ( $page == "login")
  187. {
  188. if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])){$_SERVER['HTTP_X_FORWARDED_FOR']="";}
  189. if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])){$_SERVER['HTTP_ACCEPT_CHARSET']="";}
  190. $user="";if ( $_REQUEST['user'] != "" ){$user=$_REQUEST['user'];}
  191. $passwd="";if ( $_REQUEST['passwd'] != "" ){$passwd=$_REQUEST['passwd'];}
  192. $passwd=md5($passwd);
  193. $userdata=$main->login($user, $passwd , true );
  194. if ( isset($userdata->rows) and $userdata->rows == 1 )
  195. {
  196. $userid=$userdata->records[0]['id'];
  197. $role=$userdata->records[0]['role'];
  198. $_SESSION['name']=$userdata->records[0]['name'];
  199. $_SESSION['nr']=$userdata->records[0]['nr'];
  200. $_SESSION['userid']=$userid;
  201. $_SESSION['role']=$role;
  202. $_SESSION['user']=$userdata->records[0]['user'];
  203. $_SESSION['passwd']=$passwd;
  204. $_SESSION['email']=$userdata->records[0]['email'];
  205. $_SESSION['theme']=$userdata->records[0]['theme'];
  206. //$_SESSION['img']=$userdata->records[0]['img'];
  207. //$_SESSION['data']=$userdata->records[0]['data'];
  208. $_SESSION['ip']=$_SERVER['REMOTE_ADDR'];
  209. $_SESSION['agent']="$_SERVER[HTTP_USER_AGENT]$_SERVER[HTTP_X_FORWARDED_FOR]$_SERVER[HTTP_ACCEPT_LANGUAGE]$_SERVER[HTTP_ACCEPT_CHARSET]";
  210. $_SESSION['lang']=$userdata->records[0]['lang'];
  211. }
  212. else
  213. {
  214. print "login failed";
  215. }
  216. $page="start";if ( $initpage == "true"){ $page="init";}if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
  217. }
  218. if ( isset($_SESSION['userid']) and $_SESSION['userid'] != 0 )
  219. {
  220. if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])){$_SERVER['HTTP_X_FORWARDED_FOR']="";}
  221. if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])){$_SERVER['HTTP_ACCEPT_CHARSET']="";}
  222. if ($_SESSION['ip'] == $_SERVER['REMOTE_ADDR'] and $_SESSION['agent'] == "$_SERVER[HTTP_USER_AGENT]$_SERVER[HTTP_X_FORWARDED_FOR]$_SERVER[HTTP_ACCEPT_LANGUAGE]$_SERVER[HTTP_ACCEPT_CHARSET]" )
  223. {
  224. $userid=$_SESSION['userid'];
  225. $role=$_SESSION['role'];
  226. }
  227. else
  228. {
  229. $page="logout";
  230. }
  231. }
  232. //}}}
  233. //{{{ Logout
  234. if ( $page == "logout" )
  235. {
  236. $_SESSION['name']="";
  237. $_SESSION['userid']="0";
  238. $_SESSION['role']="0";
  239. $_SESSION['user']="";
  240. $_SESSION['nr']="$confnr";
  241. $_SESSION['passwd']="";
  242. $_SESSION['email']="";
  243. $_SESSION['img']="";
  244. $_SESSION['data']="";
  245. $userid=0;
  246. $role=0;
  247. $page="start";if ( $initpage == "true"){ $page="init";}if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}
  248. }
  249. //}}}
  250. //{{{ Set Lang
  251. include_once( "lang/en.php" );
  252. $text=$main->clean_array( $text, false, true );
  253. $main->settext($text);
  254. //}}}
  255. if ($usedbsessions){if (!isset($userid)){$userid=0;}$main->run_query("update sessions set user ='$userid', page = '$page', hits = hits + 1 where session_id = '".session_id()."'");}
  256. //{{{ Download
  257. if ( $page == "dload" )
  258. {
  259. $id = $_REQUEST['id'];
  260. $fileinfo=$main->getfileinfo($id);
  261. if ($fileinfo->rows == "1")
  262. {
  263. if ( $fileinfo->records['0']['access'] > $role ){ header("HTTP/1.0 401 Unauthorized",true,401); die("401 Unauthorized");}
  264. $filename = $fileinfo->records['0']['filename'];
  265. $file = "$filepath/$id/$filename";
  266. //First, see if the file exists
  267. if (!is_file($file)) { header("HTTP/1.0 404 Not Found",true,404); die("404 File not found!"); }
  268. //Gather relevent info about file
  269. $len = $fileinfo->records['0']['size'];
  270. $ctype = $fileinfo->records['0']['type'];
  271. //Begin writing headers
  272. header("Pragma: public");
  273. header("Expires: 0");
  274. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  275. header("Cache-Control: public");
  276. if ( !isset($_REQUEST['view']))
  277. {
  278. header("Content-Description: File Transfer");
  279. header("Content-Disposition: attachment; filename=$filename;");
  280. }
  281. if ( isset($_REQUEST['view']))
  282. {
  283. if ( $_REQUEST['view'] != "true" )
  284. {
  285. header("Content-Description: File Transfer");
  286. header("Content-Disposition: attachment; filename=$filename;");
  287. }
  288. }
  289. //Use the switch-generated Content-Type
  290. header("Content-Type: $ctype");
  291. header("Content-Transfer-Encoding: binary");
  292. header("Content-Length: ".$len);
  293. @readfile($file) or die("File not found.");
  294. exit;
  295. }
  296. header("HTTP/1.0 404 Not Found",true,404);
  297. die("404 File not found.");
  298. }
  299. //}}}
  300. //{{{start of request id limit
  301. if ( "$oldrequestid" == "$requestid" and $havecookie and !$isbot )
  302. {
  303. //}}}
  304. //{{{Password recovery
  305. if ( $page == "pwdrec3" )
  306. {
  307. if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])){$_SERVER['HTTP_X_FORWARDED_FOR']="";}
  308. if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])){$_SERVER['HTTP_ACCEPT_CHARSET']="";}
  309. if ( $_SESSION['pwdid'] == $_REQUEST['pwdinid'])
  310. {
  311. $userdata=$_SESSION['tempuserlogin'];
  312. $userid=$userdata['id'];
  313. $role=$userdata['role'];
  314. $_SESSION['name']=$userdata['name'];
  315. $_SESSION['nr']=$userdata['nr'];
  316. $_SESSION['userid']=$userid;
  317. $_SESSION['role']=$role;
  318. $_SESSION['user']=$userdata['user'];
  319. $_SESSION['passwd']=$userdata['passwd'];
  320. $_SESSION['email']=$userdata['email'];
  321. $_SESSION['theme']=$userdata['theme'];
  322. //$_SESSION['img']=$userdata->records[0]['img'];
  323. //$_SESSION['data']=$userdata->records[0]['data'];
  324. $_SESSION['ip']=$_SERVER['REMOTE_ADDR'];
  325. $_SESSION['agent']="$_SERVER[HTTP_USER_AGENT]$_SERVER[HTTP_X_FORWARDED_FOR]$_SERVER[HTTP_ACCEPT_LANGUAGE]$_SERVER[HTTP_ACCEPT_CHARSET]";
  326. $_SESSION['lang']=$userdata['lang'];
  327. $page="edituser";
  328. $_REQUEST['id']=$userid;
  329. }
  330. else
  331. {
  332. print "login failed";
  333. $page="pwdrec";
  334. }
  335. }
  336. //}}}
  337. //{{{ Vote
  338. if ( "$page" == "vote" )
  339. {
  340. if ( ! isset($_SESSION['vote'][$_REQUEST['id']]) )
  341. {
  342. $_SESSION['vote'][$_REQUEST['id']]='v';
  343. if ( $_REQUEST['value'] < "6" and $_REQUEST['value'] > "0")
  344. {
  345. $main->vote($_REQUEST['id'],$_REQUEST['value']);
  346. }
  347. }
  348. $page="start";if ( $initpage == "true"){ $page="init";}if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage'])){$page=$_SESSION['lastpage'];}
  349. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  350. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  351. }
  352. //}}}
  353. //{{{ Start of imgkey sheck
  354. if ( $role > 0 or $_SESSION['imgkey'] == $_REQUEST['imgkey'])
  355. {
  356. //}}}
  357. //{{{ Save news
  358. if ( "$page" == "savenews" and "$role" > "0" )
  359. {
  360. $addnews="true";
  361. $id="";if ( $_REQUEST['id'] != "" ){$id=$_REQUEST['id'];}
  362. $access="";if ( $_REQUEST['access'] != "" ){$access=$_REQUEST['access'];}else{$addnews="false";}
  363. $headline="";if ( $_REQUEST['header'] != "" ){$headline=$_REQUEST['header'];}else{$addnews="false";}
  364. $order="";if ( $_REQUEST['order'] != "" ){$order=$_REQUEST['order'];}else{$order="1";}
  365. $type="";if ( $_REQUEST['type'] != "" ){$type=$_REQUEST['type'];}else{$type="1";}
  366. $data="";if ( $_REQUEST['news'] != "" ){$data=$_REQUEST['news'];}else{$addnews="false";}
  367. $data2="";if ( $_REQUEST['extnews'] != "" ){$data2=$_REQUEST['extnews'];}
  368. $filename="";if ( isset($_REQUEST['delimg'])){$filename="del";}
  369. $category="1";
  370. if ( $_REQUEST['newcategory'] != "" )
  371. {
  372. $newcat=$main->addCategory($_REQUEST['newcategory']);
  373. if ( isset($newcat->lastid) and $newcat->lastid != 0)
  374. {
  375. $category=$newcat->lastid;
  376. }
  377. }
  378. elseif($_REQUEST['category'] != "" ){$category=$_REQUEST['category'];}
  379. else{$addnews="false";}
  380. if ( "$addnews" == "true" )
  381. {
  382. if ( $type == "1" ){$page="start";}
  383. elseif( $type == "2" ){$page="newscat";$_REQUEST['catid']=$category;}
  384. elseif( $type == "3" ){$page="viewnews";}
  385. elseif( $type == "4" ){$page="init";$main->removeoldinit($access);}
  386. elseif( $type == "5" ){$page="myhome";$subpage="news";$_REQUEST['id']=$_SESSION['lastuid'];}
  387. elseif( $type == "6" ){$page="myhome";$subpage="private";}
  388. elseif( $type == "7" ){$page="admnews";}
  389. elseif( $type == "8" ){$page="remnews";}
  390. elseif( $type == "9" ){$page="myhome";$_REQUEST['subpage']="hidden";$_REQUEST['id']=$userid;}
  391. else {$page="start";}
  392. $_SESSION['lastpage']=$page;
  393. if ( $role >= "2" )
  394. {
  395. if ($filename == "del" or $_FILES['img']['size'] != "0" )
  396. {
  397. $thumbdir="./thumb/news/$id/";
  398. $smalldir="./small/news/$id/";
  399. $uploaddir="./img/news/$id/";
  400. if(is_dir($thumbdir))
  401. {
  402. $main->rmdirr($thumbdir);
  403. }
  404. if(is_dir($smalldir))
  405. {
  406. $main->rmdirr($smalldir);
  407. }
  408. if(is_dir($uploaddir))
  409. {
  410. $main->rmdirr($uploaddir);
  411. }
  412. }
  413. if ($_FILES['img']['size'] != "0")
  414. {
  415. $filename=$main->uploadfile( $_FILES['img'] , "news", $id );
  416. }
  417. }
  418. $result = $main->savenews( $id, $access, $headline, $filename, $data, $data2, $order, $category, $type );
  419. }
  420. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  421. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  422. }
  423. //}}}
  424. //{{{ Add news
  425. if ( "$page" == "addnews" and "$role" != "0" )
  426. {
  427. $addnews="true";
  428. $img="";
  429. $access="";if ( $_REQUEST['access'] != "" ){$access=$_REQUEST['access'];}else{$addnews="false";}
  430. $owner=$userid;
  431. $headline="";if ( $_REQUEST['header'] != "" ){$headline=$_REQUEST['header'];}else{$addnews="false";}
  432. $order="";if ( $_REQUEST['order'] != "" ){$order=$_REQUEST['order'];}else{$order="1";}
  433. $type="";if ( $_REQUEST['type'] != "" ){$type=$_REQUEST['type'];}else{$type="1";}
  434. $data="";if ( $_REQUEST['news'] != "" ){$data=$_REQUEST['news'];}else{$addnews="false";}
  435. $data2="";if ( $_REQUEST['extnews'] != "" ){$data2=$_REQUEST['extnews'];}
  436. $category="1";
  437. if ( $_REQUEST['newcategory'] != "" ){
  438. $newcat=$main->addCategory($_REQUEST['newcategory']);
  439. if ( isset($newcat->lastid) and $newcat->lastid != 0)
  440. {
  441. $category=$newcat->lastid;
  442. }
  443. }
  444. elseif($_REQUEST['category'] != "" ){$category=$_REQUEST['category'];}
  445. else{$addnews="false";}
  446. if ( "$addnews" == "true" )
  447. {
  448. if ( $type == "1" ){$page="start";}
  449. elseif( $type == "2" ){$page="newscat";$_REQUEST['catid']=$category;}
  450. elseif( $type == "3" ){$page="viewnews";}
  451. elseif( $type == "4" ){$page="init";$main->removeoldinit($access);}
  452. elseif( $type == "5" ){$page="myhome";$subpage="news";$_REQUEST['id']=$_SESSION['lastuid'];}
  453. elseif( $type == "6" ){$page="myhome";$subpage="private";}
  454. elseif( $type == "7" ){$page="admnews";}
  455. elseif( $type == "8" ){$page="remnews";}
  456. elseif( $type == "9" ){$page="myhome";$_REQUEST['subpage']="hidden";$_REQUEST['id']=$userid;}
  457. else {$page="start";}
  458. $_SESSION['lastpage']=$page;
  459. $filename=str_replace(" ","_",basename($_FILES['img']['name']));
  460. $filename=str_replace("?","a",$filename);
  461. $filename=str_replace("ä","a",$filename);
  462. $filename=str_replace("ö","o",$filename);
  463. $filename=str_replace("?","A",$filename);
  464. $filename=str_replace("Ä","A",$filename);
  465. $filename=str_replace("Ö","O",$filename);
  466. $filename=str_replace("(","_",$filename);
  467. $filename=str_replace(")","_",$filename);
  468. $filename=ereg_replace("[^a-z,A-Z,0-9,_,.]","_",$filename);
  469. $result = $main->addnews( $access, $owner, $headline, $filename, $data, $data2, $order, $category, $type );
  470. if ( $role >= "2" )
  471. {
  472. $filenam=$main->uploadfile( $_FILES['img'], "news", $result->lastid );
  473. }
  474. }
  475. }
  476. //}}}
  477. //{{{ Remove news
  478. if ( "$page" == "rmnews" and "$role" > "0" )
  479. {
  480. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
  481. $main->rmnews( $id, $role );
  482. if ($_SESSION['lastpage'] == "myhome" ){$_REQUEST['id']=$_SESSION['lastuid'];}
  483. $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
  484. if ( "$page" == "myhome")
  485. {
  486. $_REQUEST['id']=$_SESSION['lastuid'];
  487. $_REQUEST['subpage']=$_SESSION['lastsubpage'];
  488. }
  489. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  490. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  491. }
  492. //}}}
  493. //{{{ Delete news
  494. if ( "$page" == "deletenews" and "$role" >= "3")
  495. {
  496. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
  497. $main->delnews( $id, $role );
  498. $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
  499. if ($page=="viewnews"){$page="start";}
  500. if ( "$page" == "myhome")
  501. {
  502. $_REQUEST['id']=$_SESSION['lastuid'];
  503. $_REQUEST['subpage']=$_SESSION['lastsubpage'];
  504. }
  505. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  506. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  507. }
  508. //}}}
  509. //{{{ Add comment to news
  510. if ( "$page" == "addnewscomment" and ( $role >= 1 or $allowanonaddcomment == 'true' or ( $_SESSION['lastid'] == "-1" and $allowanonaddguestbook == "true" ) ) )
  511. {
  512. $id="";if ( isset($_SESSION['lastid']) ){$id=$_SESSION['lastid'];}
  513. $headline="";if ( isset($_REQUEST['header']) ){$headline=$_REQUEST['header'];}
  514. $data="";if ( isset($_REQUEST['data']) ){$data=$_REQUEST['data'];}
  515. $anonname="";if ( isset($_REQUEST['name']) ){$anonname=$_REQUEST['name'];}
  516. $_SESSION['anonname']=$anonname;
  517. $anonemail="";if ( isset($_REQUEST['email']) ){$anonemail=$_REQUEST['email'];}
  518. $_SESSION['anonemail']=$anonemail;
  519. $homepage="";if ( isset($_REQUEST['homepage'])){$homepage=$_REQUEST['homepage'];}
  520. $_SESSION['anonhomepage']=preg_replace("#(\<a)(.*?)(\>)(.*?)(\</a\>)#is","$4",$homepage);
  521. if ( $data != "" ){$main->addcomment( $userid, 1, $id, $headline, $data, $anonname, $anonemail,$homepage );}
  522. $page=$_SESSION['lastpage'];
  523. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  524. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  525. }
  526. //}}}
  527. //{{{Save comment
  528. if ( "$page" == "savecomment" and $role >= 1 )
  529. {
  530. $page=$_SESSION['lastpage'];
  531. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
  532. $headline="";if ( isset($_REQUEST['header']) ){$headline=$_REQUEST['header'];}
  533. $data="";if ( isset($_REQUEST['data']) ){$data=$_REQUEST['data'];}
  534. $anonname="";if ( isset($_REQUEST['name']) ){$anonname=$_REQUEST['name'];}
  535. $anonemail="";if ( isset($_REQUEST['email']) ){$anonemail=$_REQUEST['email'];}
  536. $homepage="";if ( isset($_REQUEST['homepage']) ){$homepage=$_REQUEST['homepage'];}
  537. if ( $headline != "" and $data != "" ){$main->savecomment( $userid, $role, $id, $headline, $data, $anonname, $anonemail, $homepage);}
  538. $_REQUEST['id']=$_SESSION['lastid'];
  539. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  540. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  541. }
  542. //}}}
  543. // {{{ Remove comments
  544. if ( "$page" == "rmcomment" and $role >= 1 )
  545. {
  546. $page=$_SESSION['lastpage'];
  547. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
  548. if ( $id != "" )
  549. {
  550. $main->rmcomment( $userid, $role, $id);
  551. }
  552. $_REQUEST['id']=$_SESSION['lastid'];
  553. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  554. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  555. }
  556. //}}}
  557. // {{{ Delete comment
  558. if ( "$page" == "deletecomment" and $role == 4 )
  559. {
  560. $page=$_SESSION['lastpage'];
  561. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
  562. if ( $id != "" )
  563. {
  564. $main->deletecomment( $id);
  565. }
  566. $_REQUEST['id']=$_SESSION['lastid'];
  567. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  568. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  569. }
  570. //}}}
  571. //{{{ Add user
  572. if ( "$page" == "adduser" and (("$role" == "0" and $allowregister == "true" ) or "$role" >= "3" ))
  573. {
  574. $adduser="true";
  575. $img="";
  576. $newrole="";if ( $_REQUEST['role'] != "" ){$newrole=$_REQUEST['role'];}else{$adduser="false";}
  577. $newname="";if ( $_REQUEST['name'] != "" ){$newname=$_REQUEST['name'];}else{$adduser="false";}
  578. $newuser="";if ( $_REQUEST['nuser'] != "" ){$newuser=$_REQUEST['nuser'];}else{$adduser="false";}
  579. $newemail="";if ( $_REQUEST['email'] != "" ){$newemail=$_REQUEST['email'];}
  580. $newdata="";if ( $_REQUEST['data'] != "" ){$newdata=$_REQUEST['data'];}
  581. $newlang="";if ( $_REQUEST['lang'] != "" ){$newlang=$_REQUEST['lang'];}else{$adduser="false";}
  582. $newpwd1="";if ( $_REQUEST['pwd1'] != "" ){$newpwd1=$_REQUEST['pwd1'];}else{$adduser="false";}
  583. $newpwd2="";if ( $_REQUEST['pwd2'] != "" ){$newpwd2=$_REQUEST['pwd2'];}else{$adduser="false";}
  584. $homepage="";if ( $_REQUEST['homepage'] != "" ){$homepage=$_REQUEST['homepage'];}
  585. $usetheme="default";
  586. if ( $allowusertheme == "true" and $_REQUEST['usetheme'] != "" )
  587. {
  588. $usetheme=$_REQUEST['usetheme'];
  589. if ( !is_file("themes/$usetheme/site.css"))
  590. {
  591. $usetheme="default";
  592. }
  593. }
  594. if( $allowusertheme != "true"){$usetheme="default";}
  595. $nr=$confnr;if ( isset($_REQUEST['nr'])){$nr=$_REQUEST['nr'];}
  596. if ( "$adduser" == "true" and ( "$role" >= "$newrole" or "$newrole" == "1" )and "$newpwd1" == "$newpwd2" )
  597. {
  598. $filename="";
  599. if ( isset($_FILES['img']))
  600. {
  601. $filename=str_replace(" ","_",basename($_FILES['img']['name']));
  602. $filename=str_replace("?","a",$filename);
  603. $filename=str_replace("ä","a",$filename);
  604. $filename=str_replace("ö","o",$filename);
  605. $filename=str_replace("?","A",$filename);
  606. $filename=str_replace("Ä","A",$filename);
  607. $filename=str_replace("Ö","O",$filename);
  608. $filename=str_replace("(","_",$filename);
  609. $filename=str_replace(")","_",$filename);
  610. $filename=ereg_replace("[^a-z,A-Z,0-9,_,.]","_",$filename);
  611. }
  612. $result = $main->adduser( $newrole,$nr,$usetheme,$newname,$newuser,$newemail,$newdata, md5($newpwd1), $filename, $newlang, $homepage );
  613. $_REQUEST['id']=$result->lastid;
  614. $_REQUEST['nextpage']="myhome";
  615. if ($newusermailtoadmin)
  616. {
  617. $admins=$main->run_query("SELECT email FROM `user` where role=4;");
  618. foreach($admins->records as $adminemails )
  619. {
  620. $main->sendMail( "$adminemails[email]" , $main->decode("$sitetitle: $text[useradded]"), $main->decode("$text[name] $newname\n$text[email] $newemail\n$text[description]\n$newdata") , "$adminemail");
  621. }
  622. }
  623. if ( $role >= "2" and isset($_FILES['img']) )
  624. {
  625. $filename=$main->uploadfile( $_FILES['img'] , "user", $result->lastid );
  626. }
  627. }
  628. $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
  629. }
  630. //}}}
  631. //{{{ Save user
  632. if ( "$page" == "saveuser" )
  633. {
  634. $adduser="true";
  635. $newid="";if ( $_REQUEST['id'] != "" ){$newid=$_REQUEST['id'];}else{$adduser="false";}
  636. $newrole="";if ( $_REQUEST['role'] != "" ){$newrole=$_REQUEST['role'];}else{$adduser="false";}
  637. $newname="";if ( $_REQUEST['name'] != "" ){$newname=$_REQUEST['name'];}else{$adduser="false";}
  638. $newemail="";if ( $_REQUEST['email'] != "" ){$newemail=$_REQUEST['email'];}
  639. $newdata="";if ( $_REQUEST['data'] != "" ){$newdata=$_REQUEST['data'];}
  640. $newlang="";if ( $_REQUEST['lang'] != "" ){$newlang=$_REQUEST['lang'];}else{$adduser="false";}
  641. $newpwd1="";if ( $_REQUEST['pwd1'] != "" ){$newpwd1=$_REQUEST['pwd1'];}
  642. $newpwd2="";if ( $_REQUEST['pwd2'] != "" ){$newpwd2=$_REQUEST['pwd2'];}
  643. $homepage="";if ( $_REQUEST['homepage'] != "" ){$homepage=$_REQUEST['homepage'];}
  644. $filename="";if ( isset($_REQUEST['delimg'])){$filename="del";}
  645. $usetheme="default";
  646. if ( $allowusertheme == "true" and $_REQUEST['usetheme'] != "" )
  647. {
  648. $usetheme=$_REQUEST['usetheme'];
  649. if ( !is_file("themes/$usetheme/site.css"))
  650. {
  651. $usetheme="default";
  652. }
  653. elseif( $newid == $userid )
  654. {
  655. $_SESSION['theme']="$usetheme";
  656. }
  657. }
  658. $nr=$confnr;if ( isset($_REQUEST['nr'])){$nr=$_REQUEST['nr'];}
  659. if ( "$role" <= "2" )
  660. {
  661. $newrole=$role;
  662. $newid=$userid;
  663. }
  664. if ( "$adduser" == "true" and ( "$role" >= "$newrole" or "$newrole" == "1" ) and "$newpwd1" == "$newpwd2" )
  665. {
  666. if ( $role >= "2" )
  667. {
  668. if ($filename == "del" or $_FILES['img']['size'] != "0" )
  669. {
  670. $thumbdir="./thumb/user/$newid/";
  671. $smalldir="./small/user/$newid/";
  672. $uploaddir="./img/user/$newid/";
  673. if(is_dir($thumbdir))
  674. {
  675. $main->rmdirr($thumbdir);
  676. }
  677. if(is_dir($smalldir))
  678. {
  679. $main->rmdirr($smalldir);
  680. }
  681. if(is_dir($uploaddir))
  682. {
  683. $main->rmdirr($uploaddir);
  684. }
  685. }
  686. if ( $_FILES['img']['size'] != "0")
  687. {
  688. $filename=$main->uploadfile( $_FILES['img'] , "user", $newid );
  689. }
  690. }
  691. if ( "$newpwd1" != "" )
  692. {
  693. $main->saveuser( $newid, $newrole, $nr,$usetheme, $newname, $newemail,$newdata, md5($newpwd1), $filename, $newlang, $homepage );
  694. }
  695. else
  696. {
  697. $main->saveuser( $newid, $newrole, $nr,$usetheme, $newname, $newemail,$newdata, "", $filename, $newlang, $homepage );
  698. }
  699. if ( $userid == $newid )
  700. {
  701. $_SESSION['lang']=$newlang;
  702. $_SESSION['nr']=$nr;
  703. $_SESSION['name']=$newname;
  704. $_SESSION['email']=$newemail;
  705. include_once( "lang/en.php" );
  706. $text=$main->clean_array( $text, false, true );
  707. $main->settext($text);
  708. }
  709. }
  710. $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
  711. }
  712. //}}}
  713. //{{{ Remove user
  714. if ( "$page" == "rmuser" and "$role" >= "3" )
  715. {
  716. $id="";if ( $_REQUEST['id'] != "" ){$id=$_REQUEST['id'];}
  717. $main->rmuser( $id );
  718. $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
  719. if ( $page == "userhome"){$page="start";if ( $initpage == "true"){ $page="init";}}
  720. }
  721. //}}}
  722. //{{{Edit abbr
  723. if ( $page == "editabbr" and $role >= "3" )
  724. {
  725. if (isset($_REQUEST['deleteid']))
  726. {
  727. $main->delabbr($_REQUEST['deleteid']);
  728. }
  729. if (isset($_REQUEST['do']))
  730. {
  731. if ($_REQUEST['do'] == "save")
  732. {
  733. $main->saveabbr($_REQUEST['id'], $_REQUEST['type'], $_REQUEST['word'] , $_REQUEST['title'], $_REQUEST['abbrdata']);
  734. }
  735. elseif ($_REQUEST['do'] == "add")
  736. {
  737. $main->addabbr( $_REQUEST['type'], $_REQUEST['word'] , $_REQUEST['title'], $_REQUEST['abbrdata'] );
  738. }
  739. }
  740. }
  741. //}}}
  742. //{{{ Delete user
  743. if ( "$page" == "deluser" and "$role" >= "4" )
  744. {
  745. $id="";if ( $_REQUEST['id'] != "" ){$id=$_REQUEST['id'];}
  746. $main->deluser( $id );
  747. $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage']) ){$page=$_SESSION['lastpage'];}
  748. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  749. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  750. if ( $page == "userhome" or $page == "myhome" ){$page="start";if ( $initpage == "true"){ $page="init";}}
  751. }
  752. //}}}
  753. //{{{end of request id limit
  754. }
  755. }
  756. //}}}
  757. //{{{ Update request id
  758. $requestid=rand(1000, 9999);
  759. $_SESSION['reqid']=$requestid;
  760. //}}}
  761. //{{{ HTML header
  762. /*print "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n";*/
  763. print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n\n";
  764. //print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
  765. print "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title>$sitetitle</title>\n<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-15' />\n";
  766. if ( $page == "changetheme" and $allowusertheme == "true")
  767. {
  768. $_SESSION['theme']=$_REQUEST['theme'];
  769. $page="start";if ( isset($_REQUEST['nextpage']) ){$page=$_REQUEST['nextpage'];}elseif(isset($_SESSION['lastpage'])){$page=$_SESSION['lastpage'];}
  770. if ( isset($_SESSION['lastnr']) and $_SESSION['lastnr'] != "" ){$_REQUEST['nr']=$_SESSION['lastnr'];}
  771. if ( isset($_SESSION['laststart']) and $_SESSION['laststart'] != "" ){$_REQUEST['start']=$_SESSION['laststart'];}
  772. }
  773. if ( isset($_SESSION['theme']))
  774. {
  775. if ($_SESSION['theme'] != "default")
  776. {
  777. $stylesheet="themes/$_SESSION[theme]/site.css";
  778. }
  779. }
  780. print "<link rel='stylesheet' href='$stylesheet' type='text/css'></link>\n";
  781. print "<meta content='$keywords' name='keywords'></meta>\n";
  782. print "<meta content='$description' name='description'></meta>\n";
  783. if ( "$enablerss" == "true" )
  784. {
  785. if ( "$role" != "0" ){print "<link rel='alternate' type='text/xml' title='RSS' href='rss.php?user=$_SESSION[user]&amp;passwd=$_SESSION[passwd]'></link>\n";}
  786. else {print "<link rel='alternate' type='text/xml' title='RSS' href='rss.php'></link>\n";}
  787. }
  788. if ( $enablesplash and ($page=="" or $page=="splash" ))
  789. {
  790. $page2="start";if ( $initpage == "true"){ $page2="init";}
  791. if ($splashtimer!=0)
  792. {
  793. print "<meta http-equiv='refresh' content='$splashtimer;url=?page=$page2' />";
  794. }
  795. }
  796. print "</head>\n";
  797. $bodyclass="gray";
  798. if ( !isset($_REQUEST['textsize']) and isset($_SESSION['textsize']) )
  799. {
  800. $_REQUEST['textsize']=$_SESSION['textsize'];
  801. }
  802. if (isset($_REQUEST['textsize']))
  803. {
  804. if( $_REQUEST['textsize'] == "s" )
  805. {
  806. $bodyclass="graysmall";
  807. }
  808. if( $_REQUEST['textsize'] == "n" )
  809. {
  810. $bodyclass="gray";
  811. }
  812. if( $_REQUEST['textsize'] == "l" )
  813. {
  814. $bodyclass="graylarge";
  815. }
  816. $_SESSION['textsize']=$_REQUEST['textsize'];
  817. }
  818. print "<body class='$bodyclass'>\n";
  819. print "<table class='main' summary='main table'><tr><td class='tls'></td><td class='ts'></td><td class='trs'></td></tr><tr><td class='ls'></td>";
  820. if ($page=="splash"){print "<td valign='middle' align='center'>\n";}else{print "<td valign='top'>\n";}
  821. //}}}
  822. //{{{ splach
  823. if ( $enablesplash and ($page=="" or $page=="splash" ))
  824. {
  825. $page2="start";if ( $initpage == "true"){ $page2="init";}
  826. print "<a href='?page=$page2'><img src='$splashimage' alt='$sitetitle' /></a>";
  827. }
  828. //}}}
  829. //{{{ Top part
  830. //start splash check
  831. if ($page!="splash")
  832. {
  833. print "<table summary='Main table'>\n";
  834. print "<tr><td><img src='$logo' alt='LOGO' width='$logowidth' /></td><td align='right' class='headerbottom'><p>&nbsp;</p>\n";
  835. if ( $enablesearch == 'true' )
  836. {
  837. $searchvalue="";
  838. $search="";if ( isset($_REQUEST['search']) ){$search=$_REQUEST['search'];}
  839. if ( $search == "" and $page == "search" and $_SESSION['lastpage']=="search" and isset($_SESSION['searchstr']) ){$search=$_SESSION['searchstr'];}
  840. if ( $search != "" ){$searchvalue="value='$search'";}
  841. print "<form enctype='multipart/form-data' action='?page=search' method='post'><p><input type='hidden' name='rid' value='$requestid' />";
  842. print "<label for='search'>$text[search]: </label><input name='search' type='text' id='search' alt='search' $searchvalue />&nbsp;";
  843. print "<input type='submit' value='$text[search]' id='searchbuttom' class='button'/>&nbsp;<input type='reset' value='$text[reset]' class='button'/></p></form>";
  844. }
  845. print "</td><td align='right' class='headermiddle'>\n";
  846. print "<table summary='information table'>";
  847. foreach ($siteheader as $headerline)
  848. {
  849. print "<tr><td align='right' class='menusmall'><b>$headerline[1]</b></td>";
  850. print "<td align='left' class='menusmall'>$headerline[2]</td></tr>";
  851. }
  852. print "</table>";
  853. print "</td></tr></table><table summary='Main table'>\n";
  854. //}}}
  855. //{{{ Menu
  856. print "<tr><td valign='top' class='menu'>\n";
  857. if ( $initpage == "true" )
  858. {
  859. print "<a href='?page=init'>$text[home]</a>&nbsp;<br />\n";
  860. }
  861. $menu = $main->getmenu( $role, $userid );
  862. $lastaccess=0;
  863. foreach( $menu->records as $item )
  864. {
  865. $curaccess=$item['access'];
  866. if ( "$lastaccess" != "$curaccess" )
  867. {
  868. print "<br />\n";
  869. }
  870. $lastaccess=$curaccess;
  871. $menuitem="";
  872. if (isset($text[ $item['data'] ])){$menuitem=str_replace(" ","&nbsp;",$text[ $item['data'] ]);}
  873. if ($menuitem == ""){$menuitem=$item['data'];}
  874. print "<a href='?page=$item[data]'>$menuitem</a>&nbsp;<br />\n";
  875. }
  876. $newslinks=$main->getmenunewslist($role);
  877. if ($newslinks->rows != "0" )
  878. {
  879. print "<br />\n";
  880. foreach( $newslinks->records as $item )
  881. {
  882. $menuitem=str_replace(" ","&nbsp;",$item['headline']);
  883. print "<a href='?page=viewnews&amp;id=$item[id]'>$menuitem</a>&nbsp;<br />\n";
  884. }
  885. }
  886. $category = $main->getCategories($role);
  887. if ($category->rows != "0" )
  888. {
  889. print "<br />$text[category]<br />\n";
  890. foreach( $category->records as $item )
  891. {
  892. $menuitem=str_replace(" ","&nbsp;",$item['name']);
  893. //if ( isset($text[$item['name']])){$menuitem=str_replace(" ","&nbsp;",$text[$item['name']]);}
  894. print "<a href='?page=newscat&amp;catid=$item[id]'>$menuitem</a>&nbsp;<br />\n";
  895. }
  896. }
  897. if ( $enablerss == "true" and "$userid" != "0" )
  898. {
  899. print "<br /><a href='rss.php?user=$_SESSION[user]&amp;passwd=$_SESSION[passwd]'><img src='images/rss.gif' alt='$text[rss]'/></a>&nbsp;<br />\n";
  900. print "<a href='atom.php?user=$_SESSION[user]&amp;passwd=$_SESSION[passwd]'><img src='images/atom.gif' alt='$text[atom]'/></a>&nbsp;<br />\n";
  901. }
  902. elseif ( $enablerss == "true" )
  903. {
  904. print "<br /><a href='rss.php'><img src='images/rss.gif' alt='$text[rss]'/></a>&nbsp;<br />\n";
  905. print "<a href='atom.php'><img src='images/atom.gif' alt='$text[atom]'/></a>&nbsp;<br />\n";
  906. }
  907. if ( $allowusertheme == "true" and "$userid" == "0")
  908. {
  909. print "<br /><form action='?'><p><select onchange=\"location=this.options[this.selectedIndex].value;\">\n";
  910. $d=dir("themes");
  911. $curtheme="";
  912. if ( isset($_SESSION['theme']))
  913. {
  914. $curtheme=$_SESSION['theme'];
  915. }
  916. print "<option value='?page=changetheme&amp;theme=default'>$text[default]</option>\n";
  917. while($entry = $d->read())
  918. {
  919. $entry=str_replace(".php","" ,$entry);
  920. if( is_dir("themes/$entry") and $entry != "." and $entry != ".." and is_file("themes/$entry/site.css"))
  921. {
  922. $selected="";
  923. if ($entry == $curtheme ){$selected="selected=selected";}
  924. print "<option value='?page=changetheme&amp;theme=$entry' $selected>$entry</option>\n";
  925. }
  926. }
  927. print "</select></p></form>\n";
  928. }
  929. else
  930. {
  931. print "<br />\n";
  932. }
  933. $textsizeurl="";
  934. if(isset($_REQUEST['nr'])){$textsizeurl.="&amp;nr=$_REQUEST[nr]";}
  935. if(isset($_REQUEST['start'])){$textsizeurl.="&amp;start=$_REQUEST[start]";}
  936. if(isset($_REQUEST['id'])){$textsizeurl.="&amp;id=$_REQUEST[id]";}
  937. print "<a href='?page=$page&amp;textsize=s&amp;rid=$requestid$textsizeurl' class='small' rel='nofollow'>A</a>";
  938. print "<a href='?page=$page&amp;textsize=n&amp;rid=$requestid$textsizeurl' class='normal' rel='nofollow'>A</a>";
  939. print "<a href='?page=$page&amp;textsize=l&amp;rid=$requestid$textsizeurl' class='large' rel='nofollow'>A</a>";
  940. print "<br />\n";
  941. if ( "$userid" == "0" and $showlogin == "true")
  942. {
  943. print "<br /><hr /><form action='?page=login' method='post'><p><input type='hidden' name='rid' value='$requestid' />\n";
  944. print "<label for='user'>$text[user]</label><br /><input type='text' alt='user' id='user' name='user' size='10'/><br />\n";
  945. print "<label for='passwd'>$text[passwd]</label><br /><input type='password' alt='password' id='passwd' name='passwd' size='10'/><br />\n";
  946. print "<input type='submit' value='$text[login]' id='login' class='button' /><br />\n";
  947. if ( $allowregister == "true" )
  948. {
  949. print "<a href='?page=newuser' rel='nofollow'>$text[register]</a>&nbsp;\n";
  950. }
  951. print "</p></form><a href='?page=pwdrec&amp;rid=$requestid' rel='nofollow'>".str_replace(" ","&nbsp;",$text['pwdrecovery'])."</a><hr />\n";
  952. }
  953. elseif ( "$userid" != "0")
  954. {
  955. print "<br /><hr />$text[logedinas]<br /><a href='?page=myhome&amp;rid=$requestid'>$_SESSION[name]</a>&nbsp;\n";
  956. print "<br />".$text["access$role"]."\n";
  957. print "<br /><a href='?page=logout&amp;rid=$requestid'>$text[logout]</a>&nbsp;<hr />\n";
  958. }
  959. if ( $cookieinfo == "true" )
  960. {
  961. print "<br /><a href='?page=cookie'>".str_replace(" ","&nbsp;",$text['cookieheader'])."</a><br /><br />";
  962. }
  963. print "</td><td valign='top' colspan='2' rowspan='2'>\n";
  964. //if ( isset($_SESSION['nr'])){$_SESSION['lastnr']=$_SESSION['nr'];}
  965. //elseif( $page != "editnews" and $page != "savenews" ){$_SESSION['lastnr']="";}
  966. if ( isset($_REQUEST['start'])){$_SESSION['laststart']=$_REQUEST['start'];}
  967. elseif( $page != "editnews" and $page != "savenews" ){$_SESSION['laststart']="";}
  968. //End splash shech
  969. }
  970. //}}}
  971. //{{{ Init page
  972. if ("$page" == "init" or ("$page" == "" and $initpage == "true" ) )
  973. {
  974. $_SESSION['lastpage']=$page;
  975. $news = $main->getinitnews($role);
  976. $main->incresenewsviews($news->records['0']['id']);
  977. $main->printnews( $news,1,$role,$userid,"-1","-1",$page,"" );
  978. }
  979. //}}}
  980. //{{{Start page
  981. if ( "$page" == "start" or ("$page" == "" and $initpage != "true" ) )
  982. {
  983. $_SESSION['lastpage']=$page;
  984. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  985. $news = $main->getnews( $role , 1 , $start , $nr);
  986. $nrofnews = $main->getnrnews( $role, 1);
  987. $nrofnews = $nrofnews->records[0]['nr'];
  988. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  989. }
  990. //}}}
  991. //{{{Search page
  992. if ( "$page" == "search" )
  993. {
  994. $_SESSION['lastpage']=$page;
  995. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  996. $search="";if ( isset($_REQUEST['search']) ){$search=$_REQUEST['search'];$_SESSION['searchstr']=$search;}elseif ( isset($_SESSION['searchstr']) ){$search=$_SESSION['searchstr'];}
  997. $news = $main->search( $search, $role , $start , $nr);
  998. $nrofnews = $main->searchnr( $search, $role );
  999. $nrofnews = $nrofnews->records[0]['nr'];
  1000. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1001. }
  1002. //}}}
  1003. //{{{ Toplist page
  1004. if ( "$page" == "top" )
  1005. {
  1006. $_SESSION['lastpage']=$page;
  1007. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1008. $news = $main->gettopnews( $role , $start , $nr);
  1009. $nrofnews = $main->getnrtopnews( $role);
  1010. $nrofnews = $nrofnews->records[0]['nr'];
  1011. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1012. }
  1013. //}}}
  1014. //{{{ Toplist view page
  1015. if ( "$page" == "topview" )
  1016. {
  1017. $_SESSION['lastpage']=$page;
  1018. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1019. $news = $main->gettopviewnews( $role , $start , $nr);
  1020. $nrofnews = $main->getnrtopnews( $role);
  1021. $nrofnews = $nrofnews->records[0]['nr'];
  1022. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1023. }
  1024. //}}}
  1025. //{{{Top comments page
  1026. if ( "$page" == "topcomment" )
  1027. {
  1028. $_SESSION['lastpage']=$page;
  1029. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1030. $news = $main->gettopcommentnews( $role, $start, $nr);
  1031. $nrofnews = $main->getnrtopnews( $role);
  1032. $nrofnews = $nrofnews->records[0]['nr'];
  1033. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1034. }
  1035. //}}}
  1036. //{{{ Category page
  1037. if ( "$page" == "newscat" )
  1038. {
  1039. $_SESSION['lastpage']=$page;
  1040. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1041. $cat="1";if ( isset($_REQUEST['catid']) ){$cat=$_REQUEST['catid'];}elseif ( isset($_SESSION['catid']) ){$cat=$_SESSION['catid'];}
  1042. $_SESSION['catid']=$cat;
  1043. $news = $main->getcatnews( $role, $start , $nr, $cat);
  1044. $nrofnews = $main->getcatnrnews( $role, $cat);
  1045. $nrofnews = $nrofnews->records[0]['nr'];
  1046. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1047. }
  1048. //}}}
  1049. //{{{ Guestbook
  1050. if ( "$page" == "guestbook" )
  1051. {
  1052. $_SESSION['lastpage']=$page;
  1053. $cstart=0;if ( isset($_REQUEST['cstart']) ){$cstart=$_REQUEST['cstart'];}
  1054. $cnr=$nr;if ( isset($_REQUEST['cnr']) ){$cnr=$_REQUEST['cnr'];}
  1055. $main->printcomments( "0", $role,$userid,$cstart,$cnr,$page,-1);
  1056. $_SESSION['lastid']="0";
  1057. }
  1058. //}}}
  1059. //{{{ Removed comments
  1060. if ( "$page" == "removedcomments" and $role >= 3)
  1061. {
  1062. $_SESSION['lastpage']=$page;
  1063. $cstart=0;if ( isset($_REQUEST['cstart']) ){$cstart=$_REQUEST['cstart'];}
  1064. $cnr=$nr;if ( isset($_REQUEST['cnr']) ){$cnr=$_REQUEST['cnr'];}
  1065. $main->printcomments( "-1", $role,$userid,$cstart,$cnr,$page,-1);
  1066. $_SESSION['lastid']="-1";
  1067. }
  1068. //}}}
  1069. //{{{ Edit comment
  1070. if ( $page == "editcomment" and $role >= 1)
  1071. {
  1072. print "<script type='text/javascript'>
  1073. function validate(form)
  1074. {
  1075. error=\"\";
  1076. if ( form.header.value == \"\" )
  1077. {
  1078. error=\"".str_replace(":",","," ".$main->edit_array( $text['header'])." ")."\";
  1079. }
  1080. if ( form.data.value == \"\" )
  1081. {
  1082. error=error+\"".str_replace(":",""," ".$main->edit_array( $text['comment'])." ")."\";
  1083. }
  1084. if (error != '' )
  1085. {
  1086. error=error.replace(\":\", \",\");
  1087. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  1088. return;
  1089. }
  1090. else
  1091. {
  1092. form.submit();
  1093. }
  1094. }
  1095. </script>";
  1096. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
  1097. $comment=$main->edit_array($main->getcomment( $userid, $role, $id ));
  1098. print "<form enctype='multipart/form-data' action='?page=savecomment' method='post'><p><input type='hidden' name='rid' value='$requestid' /></p>\n";
  1099. print "<table summary='$text[editcomment]'><tr><td colspan='2'><hr></td></tr>\n";
  1100. if ( $comment['records']['0']['role'] == 0 )
  1101. {
  1102. print "<tr><td>$text[name]</td><td><input name='name' type='text' id='name' value='" . $comment['records']['0']['anonname'] . "'/></td></tr>\n";
  1103. print "<tr><td>$text[email]</td><td><input name='email' type='text' id='email' value='" . $comment['records']['0']['anonemail'] . "'/></td></tr>\n";
  1104. print "<tr><td>$text[homepageheader]</td><td><input name='homepage' type='text' id='email' value='" . $comment['records']['0']['anonhomepage'] . "'/></td></tr>\n";
  1105. }
  1106. print "<tr><td>$text[header]</td><td><input name='header' type='text' id='header' value='" . $comment['records']['0']['headline'] . "'/></td></tr>\n";
  1107. print "<tr><td colspan='2'>$text[comment]</td></tr>\n";
  1108. print "<tr><td colspan='2'><input type='hidden' name='id' value='" . $comment['records']['0']['id'] . "'><textarea name='data' rows='5' cols='60'>" . $comment['records']['0']['data'] . "</textarea></td></tr>\n";
  1109. print "<tr><td colspan='2'><input type='button' value='$text[savecomment]' id='savecomment' onclick=\"validate(this.form)\" class='button'/> <input type='reset' value='$text[reset]' class='button' /></td></tr>\n";
  1110. print "</table></form>\n";
  1111. print "$bbcode";
  1112. }
  1113. //}}}
  1114. //{{{ Remnews
  1115. if ( "$page" == "remnews" and "$role" >= "3" )
  1116. {
  1117. $_SESSION['lastpage']=$page;
  1118. $start="0";if ( isset($_REQUEST['start'])){$start=$_REQUEST['start'];}
  1119. $news = $main->getnews( 4 , 8 , $start , $nr);
  1120. $nrofnews = $main->getnrnews( 4, 8);
  1121. $nrofnews = $nrofnews->records[0]['nr'];
  1122. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1123. }
  1124. //}}}
  1125. //{{{ Downloads
  1126. if ( $page == "downloads")
  1127. {
  1128. print "<span class=\"headline\"><b>$text[downloads]</b></span><br />";
  1129. $dir="/";if( isset($_REQUEST['dir'])){$dir=$_REQUEST['dir'];}
  1130. if ( !isset($_REQUEST['do']) )
  1131. {
  1132. $_REQUEST['do']="";
  1133. }
  1134. if ( $role >= 3 or $role >= $uploadfileaccess )
  1135. {
  1136. if($_REQUEST['do'] == "upload" and isset($_FILES['file']['name']))
  1137. {
  1138. $filename=str_replace(" ","_",basename($_FILES['file']['name']));
  1139. $filename=str_replace("?","a",$filename);
  1140. $filename=str_replace("ä","a",$filename);
  1141. $filename=str_replace("ö","o",$filename);
  1142. $filename=str_replace("?","A",$filename);
  1143. $filename=str_replace("Ä","A",$filename);
  1144. $filename=str_replace("Ö","O",$filename);
  1145. $filename=str_replace("(","_",$filename);
  1146. $filename=str_replace(")","_",$filename);
  1147. $filename=ereg_replace("[^a-z,A-Z,0-9,_,.]","_",$filename);
  1148. $fname=$_REQUEST['fname'];
  1149. $access=$_REQUEST['access'];
  1150. $dir=$_REQUEST['dir'];
  1151. $subdir=$_REQUEST['subdir'];
  1152. $parrentdir=$_REQUEST['parentdir'];
  1153. if ( $subdir != "" )
  1154. {
  1155. $parrentdir=$dir;
  1156. $dir=$subdir;
  1157. }
  1158. $type=$_FILES['file']['type'];
  1159. $owner=$userid;
  1160. $size=$_FILES['file']['size'];
  1161. $newid=$main->addfile($filename,$fname,$access,$dir,$parrentdir,$type,$owner,$size);
  1162. if ( ! $main->uploadanyfile($_FILES['file'],"$filepath/$newid/"))
  1163. {
  1164. $main->deletefile($newid);
  1165. }
  1166. }
  1167. if($_REQUEST['do'] == "save" and isset($_REQUEST['id']))
  1168. {
  1169. $access=$_REQUEST['access'];
  1170. $dir=$_REQUEST['dir'];
  1171. $subdir=$_REQUEST['subdir'];
  1172. $parrentdir=$_REQUEST['parentdir'];
  1173. $fname=$_REQUEST['fname'];
  1174. if ( $subdir != "" )
  1175. {
  1176. $parrentdir=$dir;
  1177. $dir=$subdir;
  1178. }
  1179. $newid=$_REQUEST['id'];
  1180. $main->savefile($access, $dir, $parrentdir,$fname,$newid);
  1181. }
  1182. if ($_REQUEST['do'] == "delete" and isset($_REQUEST['id']))
  1183. {
  1184. if ($_REQUEST['id'] > 0 )
  1185. {
  1186. $main->deletefile($_REQUEST['id']);
  1187. }
  1188. }
  1189. if ($_REQUEST['do'] == "edit" and isset($_REQUEST['id']))
  1190. {
  1191. $fileinfo=$main->getfileedit($_REQUEST['id']);
  1192. print "<script type='text/javascript'>
  1193. function savevalidate(form)
  1194. {
  1195. error=\"\";
  1196. if ( form.fname.value == \"\" )
  1197. {
  1198. error=\"".str_replace(":",","," ".$main->edit_array( $text['fname'])." ")."\";
  1199. }
  1200. if (error != '' )
  1201. {
  1202. error=error.replace(\":\", \",\");
  1203. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  1204. return;
  1205. }
  1206. else
  1207. {
  1208. form.submit();
  1209. }
  1210. }
  1211. </script>";
  1212. print "<br /><br /><form enctype='multipart/form-data' action='?page=downloads' method='post'>
  1213. <table><tr><td>
  1214. <input type='hidden' name='rid' value='$requestid' />
  1215. <input type='hidden' name='id' value='$_REQUEST[id]' />
  1216. <input type='hidden' name='do' value='save' />
  1217. <input type='hidden' name='parentdir' value='".$fileinfo->records['0']['parrentdir']."' />
  1218. <input type='hidden' name='dir' value='$dir' />
  1219. $text[filename]</td><td>".$fileinfo->records['0']['filename']."</td></tr>
  1220. <tr><td>$text[size]</td><td>".$fileinfo->records['0']['size']."</td></tr>
  1221. <tr><td>$text[uploaded]</td><td>".$fileinfo->records['0']['date']."</td></tr>
  1222. \n";
  1223. print "<tr><td><label for='fname'>$text[fname]</label></td><td><input name='fname' type='text' id='fname' value='".$fileinfo->records['0']['name']."'/></td></tr>";
  1224. print "<tr><td><label for='subdir'>$text[subdir]</label></td><td><input name='subdir' type='text' id='subdir' value='".$fileinfo->records['0']['dir']."'/></td></tr>";
  1225. print "<tr><td><label for='access'>$text[access]</label></td><td><select name='access'>";
  1226. $editedfileaccess=$fileinfo->records['0']['access'];
  1227. $selected="";
  1228. if ( $editedfileaccess == 0 ){$selected="selected=selected";}else{$selected="";}
  1229. print "<option value='0' $selected>$text[noaccess]</option>\n";
  1230. if ( $editedfileaccess == 1 ){$selected="selected=selected";}else{$selected="";}
  1231. print "<option value='1' $selected>$text[limiteduser]</option>\n";
  1232. if ( $editedfileaccess == 2 ){$selected="selected=selected";}else{$selected="";}
  1233. print "<option value='2' $selected>$text[normaluser]</option>\n";
  1234. if ( $editedfileaccess == 3 ){$selected="selected=selected";}else{$selected="";}
  1235. print "<option value='3' $selected>$text[moderator]</option>\n";
  1236. if ( $editedfileaccess == 4 ){$selected="selected=selected";}else{$selected="";}
  1237. if ( "$editedfileaccess" == "0" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" ) ){print "<option $selected value='0'>$text[access0]</option>\n";}
  1238. if ( "$editedfileaccess" == "1" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" ) ){print "<option $selected value='1'>$text[access1]</option>\n";}
  1239. if ( "$editedfileaccess" == "2" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "2" ){print "<option $selected value='2'>$text[access2]</option>\n";}
  1240. if ( "$editedfileaccess" == "3" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" ){print "<option $selected value='3'>$text[access3]</option>\n";}
  1241. if ( "$editedfileaccess" == "4" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "4" ){print "<option $selected value='4'>$text[access4]</option>\n";}
  1242. print "<option value='4' $selected>$text[admin]</option>\n";
  1243. print "</select></td></tr>";
  1244. print "<tr><td colspan='2'><input type='button' value='$text[savefile]' id='uploadefile' onclick=\"savevalidate(this.form)\" class='button'/></td></tr></table></form>";
  1245. }
  1246. }
  1247. $parentdir="/";
  1248. $files=$main->getdownloads($role,$dir);
  1249. $subdirs=$main->getsubdirs($role,$dir);
  1250. if ($files->rows > "0" )
  1251. {
  1252. $parentdir=$files->records['0']['parrentdir'];
  1253. }
  1254. if ( $dir != "/" )
  1255. {
  1256. if ( "$parentdir" == "/" )
  1257. {
  1258. print "<b><a href='?page=downloads&amp;rid=$requestid'>..</a>&nbsp;&nbsp;</b>";
  1259. }
  1260. else
  1261. {
  1262. print "<b><a href='?page=downloads&amp;dir=$parentdir&amp;rid=$requestid'>..</a>&nbsp;&nbsp;</b>";
  1263. }
  1264. }
  1265. print "<b>$dir</b>";
  1266. $togler=0;
  1267. $class="class='titlesmall'";
  1268. print "<table><tr>";
  1269. print "<th $class>$text[fname]</th>";
  1270. print "<th $class>$text[size]</th>";
  1271. print "<th $class>$text[uploaded]</th>";
  1272. print "<th $class>$text[owner]</th>";
  1273. if ($role >= 3 )
  1274. {
  1275. print "<th $class>$text[bbcode]</th>";
  1276. }
  1277. print "<th $class >$text[nrdownloads]</th>";
  1278. if ( $role >= 3 or $role >= $uploadfileaccess )
  1279. {
  1280. print "<th $class >$text[actions]</th>";
  1281. }
  1282. print "</tr>";
  1283. foreach( $subdirs->records as $sdir )
  1284. {
  1285. $class="class='small'";
  1286. if ( $togler % 2 == 1 )
  1287. {
  1288. $class="class='lightsmall'";
  1289. }
  1290. $togler++;
  1291. print "<tr><td $class>$text[dir]</td><td $class colspan='5'><a $class href='?page=downloads&amp;dir=$sdir[dir]'>$sdir[dir]</a></td></tr>";
  1292. }
  1293. foreach( $files->records as $fileinfo )
  1294. {
  1295. $class="class='small'";
  1296. if ( $togler % 2 == 1 )
  1297. {
  1298. $class="class='lightsmall'";
  1299. }
  1300. $togler++;
  1301. print "<tr>";
  1302. print "<td $class><a href='?page=dload&amp;id=$fileinfo[id]' $class>$fileinfo[name]</a></td>";
  1303. print "<td $class>$fileinfo[size]</td>";
  1304. print "<td $class>$fileinfo[date]</td>";
  1305. print "<td $class>";
  1306. if ( $fileinfo['uname'] != "" and ($role != "0" or ($allowanonuserhome == "true" and $showuser == "true" )))
  1307. {
  1308. print "<a $class href='?page=userhome&amp;id=$fileinfo[owner]'>$fileinfo[uname]</a>\n";
  1309. }
  1310. else
  1311. {
  1312. print "$fileinfo[uname]</td>";
  1313. }
  1314. if ($role >= 3 )
  1315. {
  1316. print "<td $class>[file=$fileinfo[id]][/file]</td>";
  1317. }
  1318. print "<td $class>$fileinfo[hits]</td>";
  1319. if ($role >= 3 or ( $role >= $uploadfileaccess and $fileinfo['owner'] == $userid ) )
  1320. {
  1321. print "<td $class><a $class href='?page=downloads&amp;do=delete&amp;id=$fileinfo[id]&amp;rid=$requestid'>$text[delete]</a>";
  1322. print "&nbsp;<a $class href='?page=downloads&amp;do=edit&amp;id=$fileinfo[id]&amp;rid=$requestid'>$text[edit]</a></td>";
  1323. }
  1324. print "</tr>";
  1325. }
  1326. print "</table>";
  1327. if ( $role >= $uploadfileaccess and $_REQUEST['do'] != "edit" )
  1328. {
  1329. print "<script type='text/javascript'>
  1330. function validate(form)
  1331. {
  1332. error=\"\";
  1333. if ( form.fname.value == \"\" )
  1334. {
  1335. error=\"".str_replace(":",","," ".$main->edit_array( $text['fname'])." ")."\";
  1336. }
  1337. if ( form.file.value == \"\" )
  1338. {
  1339. error=error+\"".str_replace(":",""," ".$main->edit_array( $text['file'])." ")."\";
  1340. }
  1341. if (error != '' )
  1342. {
  1343. error=error.replace(\":\", \",\");
  1344. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  1345. return;
  1346. }
  1347. else
  1348. {
  1349. form.submit();
  1350. }
  1351. }
  1352. </script>";
  1353. print "<br /><br /><form enctype='multipart/form-data' action='?page=downloads' method='post'>
  1354. <table><tr><td>
  1355. <input type='hidden' name='rid' value='$requestid' />
  1356. <input type='hidden' name='do' value='upload' />
  1357. <input type='hidden' name='parentdir' value='$parentdir' />
  1358. <input type='hidden' name='dir' value='$dir' />\n";
  1359. print "<tr><td><label for='fname'>$text[fname]</label></td><td><input name='fname' type='text' id='fname'/></td></tr>";
  1360. print "<tr><td><label for='subdir'>$text[subdir]</label></td><td><input name='subdir' type='text' id='subdir'/></td></tr>";
  1361. print "<tr><td><label for='file'>$text[file]</label></td><td><input type='file' id='file' name='file'/> $text[maxfilesize] $text_upload_max_filesize<input type='hidden' name='MAX_FILE_SIZE' value='$form_upload_max_filesize' /></td></tr>";
  1362. print "<tr><td><label for='access'>$text[access]</label></td><td><select name='access'>";
  1363. if ( "$defaultnewsaccess" == "0" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" ) ){print "<option $selected value='0'>$text[access0]</option>\n";}
  1364. if ( "$defaultnewsaccess" == "1" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" ) ){print "<option $selected value='1'>$text[access1]</option>\n";}
  1365. if ( "$defaultnewsaccess" == "2" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "2" ){print "<option $selected value='2'>$text[access2]</option>\n";}
  1366. if ( "$defaultnewsaccess" == "3" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" ){print "<option $selected value='3'>$text[access3]</option>\n";}
  1367. if ( "$defaultnewsaccess" == "4" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "4" ){print "<option $selected value='4'>$text[access4]</option>\n";}
  1368. print "</select></td></tr>";
  1369. print "<tr><td colspan='2'><input type='button' value='$text[uploadfile]' id='uploadefile' onclick=\"validate(this.form)\" class='button'/></td></tr></table></form>";
  1370. }
  1371. }
  1372. //}}}
  1373. //{{{Admin news
  1374. if ( "$page" == "admnews" and "$role" >= "3" )
  1375. {
  1376. $_SESSION['lastpage']=$page;
  1377. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1378. $news = $main->getnews( $role , 7 , $start , $nr);
  1379. $nrofnews = $main->getnrnews( $role, 7);
  1380. $nrofnews = $nrofnews->records[0]['nr'];
  1381. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1382. }
  1383. //}}}
  1384. //{{{Admin news
  1385. if ( "$page" == "admhiddennews" and "$role" >= "3" )
  1386. {
  1387. $_SESSION['lastpage']=$page;
  1388. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1389. $news = $main->getnews( $role , 9 , $start , $nr);
  1390. $nrofnews = $main->getnrnews( $role, 9);
  1391. $nrofnews = $nrofnews->records[0]['nr'];
  1392. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  1393. }
  1394. //}}}
  1395. //{{{ Myhome
  1396. if ( ("$page" == "myhome" or "$page" == "userhome") and ( "$role" >= "1" or "$allowanonuserhome" ))
  1397. {
  1398. $myhomeid=$userid;if ( isset($_REQUEST['id'])){$myhomeid=$_REQUEST['id'];}
  1399. $usertable = $main->getuser($myhomeid);
  1400. $uuser=$usertable->records[0];
  1401. if ( !isset($subpage)){$subpage="";if ( isset($_REQUEST['subpage'])){$subpage=$_REQUEST['subpage'];}}
  1402. $_SESSION['lastpage']=$page;
  1403. $_SESSION['lastsubpage']=$subpage;
  1404. $_SESSION['lastuid']=$myhomeid;
  1405. if ( $myhomeid != 0 )
  1406. {
  1407. print "<b>$uuser[name]</b><br /><a href='?page=myhome&amp;id=$myhomeid&amp;rid=$requestid'>$text[userhome]</a>\n";
  1408. print " | <a href='?page=myhome&amp;subpage=news&amp;id=$myhomeid&amp;rid=$requestid'>$text[usernews]</a>\n";
  1409. }
  1410. else
  1411. {
  1412. print "<b>$uuser[name]</b>\n";
  1413. }
  1414. if ( $myhomeid == $userid and $role > "0" )
  1415. {
  1416. print " | <a href='?page=myhome&amp;subpage=private&amp;id=$myhomeid&amp;rid=$requestid'>$text[privatenews]</a>\n";
  1417. print " | <a href='?page=myhome&amp;subpage=hidden&amp;id=$myhomeid&amp;rid=$requestid'>$text[admhiddennews]</a>\n";
  1418. }
  1419. if ( "$subpage" == "" )
  1420. {
  1421. print "<table width='100%' summary='user details'><tr><td colspan='2'><hr /></td></tr>\n";
  1422. if ( $role >= "3" and $myhomeid != $userid)
  1423. {
  1424. print "<tr><td colspan='2'><a href='?page=edituser&amp;id=$uuser[id]&amp;rid=$requestid'>$text[edit]</a> | <a href='?page=rmuser&amp;id=$uuser[id]&amp;rid=$requestid'>$text[remove]</a> | <a href='?page=deluser&amp;id=$uuser[id]&amp;rid=$requestid'>$text[delete]</a></td></tr>\n";
  1425. }
  1426. elseif ( $myhomeid == $userid and $role > "0" )
  1427. {
  1428. print "<tr><td colspan='2'><a href='?page=edituser&amp;id=$uuser[id]&amp;rid=$requestid'>$text[edit]</a></td></tr>\n";
  1429. }
  1430. print "<tr><td>$text[name]</td><td>$uuser[name]</td></tr>\n";
  1431. $uuser['homepage']=str_replace("class=\"title\"", "",$uuser['homepage']);
  1432. print "<tr><td>$text[homepageheader]</td><td>$uuser[homepage]</td></tr>\n";
  1433. if ( $myhomeid != 0 )
  1434. {
  1435. print "<tr><td>$text[role]</td><td>".$text["access$uuser[role]"]."</td></tr>\n";
  1436. }
  1437. if ( $role >= "2" or ( $myhomeid == $userid and $role > "0") )
  1438. {
  1439. print "<tr><td>$text[email]</td><td>$uuser[email]</td></tr>\n";
  1440. print "<tr><td>$text[nrofnews]</td><td>$uuser[nr]</td></tr>\n";
  1441. print "<tr><td>$text[nrlogins]</td><td>$uuser[nrlogins]</td></tr>\n";
  1442. if ( ($myhomeid == $userid and $role != "0") or $role >= "3" )
  1443. {
  1444. print "<tr><td>$text[curip]</td><td>$uuser[ip]</td></tr>\n";
  1445. print "<tr><td>$text[curlogin]</td><td>$uuser[login]</td></tr>\n";
  1446. print "<tr><td>$text[lastip]</td><td>$uuser[lastip]</td></tr>\n";
  1447. print "<tr><td>$text[lastlogin]</td><td>$uuser[lastlogin]</td></tr>\n";
  1448. }
  1449. else
  1450. {
  1451. print "<tr><td>$text[lastip]</td><td>$uuser[ip]</td></tr>\n";
  1452. print "<tr><td>$text[lastlogin]</td><td>$uuser[login]</td></tr>\n";
  1453. }
  1454. }
  1455. $lang="lang$uuser[lang]";
  1456. print "<tr><td>$text[lang]</td><td>$text[$lang]</td></tr>\n";
  1457. print "<tr><td>$text[description]</td><td>$uuser[data]</td></tr>\n";
  1458. if( isset($uuser['img']) and $uuser['img'] != "" )
  1459. {
  1460. print "<tr><td>$text[image]</td><td><a class='title' href='img/user/$uuser[id]/$uuser[img]' onclick='window.open(this.href);return false;'><img src='thumb/user/$uuser[id]/$uuser[img]' alt='$uuser[name]'/></a></td></tr>\n";
  1461. }
  1462. print "</table>\n";
  1463. }
  1464. if ( "$subpage" == "news")
  1465. {
  1466. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1467. $news = $main->getusernews( $myhomeid , $role, 5 , $start , $nr);
  1468. $nrofnews = $main->getnrusernews( $myhomeid, $role, 5 );
  1469. $nrofnews = $nrofnews->records[0]['nr'];
  1470. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"news" );
  1471. }
  1472. if ( "$subpage" == "hidden" and $myhomeid == $userid )
  1473. {
  1474. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  1475. $news = $main->getusernews( $myhomeid , $role, 9 , $start , $nr);
  1476. $nrofnews = $main->getnrusernews( $myhomeid, $role, 9 );
  1477. $nrofnews = $nrofnews->records[0]['nr'];
  1478. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"news" );
  1479. }
  1480. if ( "$subpage" == "private" and $myhomeid == $userid)
  1481. {
  1482. $start="0";if ( isset($_REQUEST['start'])){$start=$_REQUEST['start'];}
  1483. $news = $main->getusernews( $myhomeid , $role, 6 , $start , $nr);
  1484. $nrofnews = $main->getnrusernews( $myhomeid, $role, 6);
  1485. $nrofnews = $nrofnews->records[0]['nr'];
  1486. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"private" );
  1487. }
  1488. }
  1489. //}}}
  1490. //{{{New news
  1491. if ( "$page" == "newnews" and "$role" >= "1" )
  1492. {
  1493. print "<script type='text/javascript'>
  1494. function validate(form)
  1495. {
  1496. error=\"\";
  1497. if ( form.header.value == \"\" )
  1498. {
  1499. error=\"".str_replace(":",","," ".$main->edit_array( $text['header'])." ")."\";
  1500. }
  1501. if ( form.news.value == \"\" )
  1502. {
  1503. error=error+\"".str_replace(":",""," ".$main->edit_array( $text['newstext'])." ")."\";
  1504. }
  1505. if (error != '' )
  1506. {
  1507. error=error.replace(\":\", \",\");
  1508. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  1509. return;
  1510. }
  1511. else
  1512. {
  1513. form.submit();
  1514. }
  1515. }
  1516. </script>";
  1517. print "<form enctype='multipart/form-data' action='?page=addnews' method='post'><p><input type='hidden' name='rid' value='$requestid' /></p>\n";
  1518. print "<table summary='New news'>\n";
  1519. print "<tr><td colspan='3'><span class=\"headline\"><b>$text[newnews]</b></span></td></tr>\n";
  1520. print "<tr><td>$text[access]</td><td> <select name='access'>\n";
  1521. if ( "$defaultnewsaccess" == "0" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" ) ){print "<option $selected value='0'>$text[access0]</option>\n";}
  1522. if ( "$defaultnewsaccess" == "1" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" ) ){print "<option $selected value='1'>$text[access1]</option>\n";}
  1523. if ( "$defaultnewsaccess" == "2" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "2" ){print "<option $selected value='2'>$text[access2]</option>\n";}
  1524. if ( "$defaultnewsaccess" == "3" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" ){print "<option $selected value='3'>$text[access3]</option>\n";}
  1525. if ( "$defaultnewsaccess" == "4" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "4" ){print "<option $selected value='4'>$text[access4]</option>\n";}
  1526. print "</select></td></tr>\n";
  1527. if ( "$role" >= "3" )
  1528. {
  1529. print "<tr><td>$text[sticky]</td><td> <select name='order'>\n";
  1530. print "<option value='1'>$text[sticky1]</option>\n";
  1531. print "<option value='0'>$text[sticky0]</option>\n";
  1532. print "</select></td></tr>\n";
  1533. }
  1534. print "<tr><td>$text[newstype]</td><td> <select name='type'>\n";
  1535. if ( $role >= "2" ){print "<option value='1'>$text[type1]</option>\n";}
  1536. if ( $role >= "2" ){print "<option value='2'>$text[type2]</option>\n";}
  1537. if ( $role >= "3" ){print "<option value='3'>$text[type3]</option>\n";}
  1538. if ( $role >= "3" and $initpage == "true" ){print "<option value='4'>$text[type4]</option>\n";}
  1539. if ( $role >= "1" ){print "<option value='5'>$text[type5]</option>\n";}
  1540. if ( $role >= "1" ){print "<option value='6'>$text[type6]</option>\n";}
  1541. if ( $role >= "3" ){print "<option value='7'>$text[type7]</option>\n";}
  1542. if ( $role >= "3" ){print "<option value='8'>$text[type8]</option>\n";}
  1543. if ( $role >= "2" ){print "<option value='9'>$text[type9]</option>\n";}
  1544. print "</select></td></tr>\n";
  1545. $category = $main->getAllCategories();
  1546. print "<tr><td>$text[category]</td><td> <select name='category'>\n";
  1547. foreach( $category->records as $item )
  1548. {
  1549. $catitem=str_replace(" ","&nbsp;",$item['name']);
  1550. if ( isset($text[$item['name']])){$catitem=str_replace(" ","&nbsp;",$text[$item['name']]);}
  1551. print "<option value='$item[id]'>$catitem</option>\n";
  1552. }
  1553. print "</select><input name='newcategory' type='text' id='newcategory'/></td></tr>\n";
  1554. if ( $role >= "2" ){print "<tr><td>$text[image]</td><td> <input type='file' id='img' name='img'/> $text[maxfilesize] $text_upload_max_filesize<input type='hidden' name='MAX_FILE_SIZE' value='$form_upload_max_filesize' /></td></tr>\n";}
  1555. print "<tr><td>$text[header]</td><td><input name='header' type='text' id='header'/></td></tr>\n";
  1556. print "<tr><td colspan='2'>$text[newstext]</td></tr>\n";
  1557. print "<tr><td colspan='2'><textarea name='news' rows='20' cols='60'>$defaultnewstext</textarea></td></tr>\n";
  1558. print "<tr><td colspan='2'>$text[extnewstext]</td></tr>\n";
  1559. print "<tr><td colspan='2'><textarea name='extnews' rows='20' cols='60'></textarea></td></tr>\n";
  1560. print "<tr><td colspan='2'><input type='button' value='$text[addnews]' id='addnews' onclick=\"validate(this.form)\" class='button'/> <input type='reset' value='$text[reset]' class='button'/></td></tr>\n";
  1561. print "</table></form>\n";
  1562. print "$bbcode";
  1563. }
  1564. //}}}
  1565. //{{{New user
  1566. if ( "$page" == "newuser" and ( "$role" == "0" or "$role" >= "3" ))
  1567. {
  1568. print "<script type='text/javascript'>
  1569. function validate(form)
  1570. {
  1571. error=\"\";
  1572. if ( form.name.value == \"\" )
  1573. { error=\"".str_replace(":",","," ".$main->edit_array( $text['name'])." ")."\";
  1574. }
  1575. if ( form.nuser.value == \"\" )
  1576. { error=error+\"".str_replace(":",","," ".$main->edit_array( $text['username'])." ")."\";
  1577. }
  1578. if ( form.pwd1.value == \"\" )
  1579. { error=error+\"".str_replace(":",","," ".$main->edit_array( $text['passwd'])." ")."\";
  1580. }
  1581. if ( form.pwd2.value == \"\" )
  1582. { error=error+\"".str_replace(":",","," ".$main->edit_array( $text['verify'])." ")."\";
  1583. }
  1584. if ( form.email.value == \"\" )
  1585. { error=error+\"".str_replace(":",","," ".$main->edit_array( $text['email'])." ")."\";
  1586. }
  1587. ";
  1588. if ("$role" == "0")
  1589. {
  1590. print "
  1591. if ( form.imgkey.value == \"\" )
  1592. {
  1593. error=error+\"".str_replace(":",","," ".$main->edit_array( $text['imgkey'])." ")."\";
  1594. }";
  1595. }
  1596. print "if (error != '' )
  1597. {
  1598. error=error.replace(\":\", \",\");
  1599. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  1600. return;
  1601. }
  1602. else
  1603. {
  1604. form.submit();
  1605. }
  1606. }
  1607. </script>";
  1608. print "<form enctype='multipart/form-data' action='?page=adduser' method='post'><p><input type='hidden' name='rid' value='$requestid' />\n";
  1609. if ( "$role" < "3" )
  1610. {
  1611. print "<input type='hidden' name='role' value='1' />\n";
  1612. }
  1613. print "</p><table summary='add user'><tr><td colspan='3'><span class=\"headline\"><b>$text[newuser]</b></span></td></tr>\n";
  1614. if( "$role" >= "3" )
  1615. {
  1616. print "<tr><td>$text[role]</td><td>\n";
  1617. print "<select name='role'>\n";
  1618. print "<option value='1'>$text[limiteduser]</option>\n";
  1619. print "<option value='2'>$text[normaluser]</option>\n";
  1620. print "<option value='3'>$text[moderator]</option>\n";
  1621. if( "$role" == "4" ){print "<option value='4'>$text[admin]</option>\n";}
  1622. print "</select></td></tr>\n";
  1623. }
  1624. print "<tr><td>$text[name]</td><td><input name='name' type='text' id='name'/></td></tr>\n";
  1625. print "<tr><td>$text[username]</td><td><input name='nuser' type='text' id='nuser'/></td></tr>\n";
  1626. print "<tr><td>$text[passwd]</td><td><input name='pwd1' type='password' id='pwd1'/>$text[verify]<input name='pwd2' type='password' id='pwd2'/></td></tr>\n";
  1627. print "<tr><td>$text[email]</td><td><input name='email' type='text' id='email'/></td></tr>\n";
  1628. print "<tr><td>$text[homepageheader]</td><td><input name='homepage' type='text' id='homepage'/></td></tr>\n";
  1629. print "<tr><td>$text[lang]</td><td>\n";
  1630. print "<select name='lang'>\n";
  1631. $d=dir("lang");
  1632. while($entry = $d->read())
  1633. {
  1634. $entry_path = "lang/$entry";
  1635. if( is_file("lang/$entry") and substr_count($entry, 'mod_') == 0 )
  1636. {
  1637. $entry=str_replace(".php","",$entry);
  1638. $selected="";
  1639. if ( $lang == $entry ){$selected=" selected='selected'";}
  1640. if ( $text["lang$entry"] != "" )
  1641. {
  1642. print "<option value='$entry'$selected>".$text["lang$entry"]."</option>\n";
  1643. }
  1644. else
  1645. {
  1646. print "<option value='$entry'$selected>$entry</option>\n";
  1647. }
  1648. }
  1649. }
  1650. print "</select></td></tr>\n";
  1651. if ("$role" == "0")
  1652. {
  1653. print "<tr><td>$text[imgkey]&nbsp;<span class='smaller'>$text[imgkeyhelp]</span></td><td><input name='imgkey' type='text' id='imgkey' value='' /><img src='randimg.php?rid=$requestid' alt='$text[imgkey]'/></td></tr>\n";
  1654. }
  1655. print "<tr><td>$text[nrofnews]</td><td>\n";
  1656. print "<select name='nr'>";
  1657. $selected="";$nrselect=$newscol * 5;if ( $nr == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1658. $selected="";$nrselect=$newscol * 10;if ( $nr == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1659. $selected="";$nrselect=$newscol * 20;if ( $nr == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1660. $selected="";$nrselect=$newscol * 40;if ( $nr == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1661. $selected="";$nrselect=$newscol * 80;if ( $nr == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1662. print "</select></td></tr>\n";
  1663. if ( $allowusertheme == "true" )
  1664. {
  1665. print "<tr><td>$text[theme]</td><td><select name='usetheme'>\n";
  1666. $d=dir("themes");
  1667. $curtheme="";
  1668. if (isset($_SESSION['theme'])){$curtheme=$_SESSION['theme'];}
  1669. print "<option value='default'>$text[default]</option>\n";
  1670. while($entry = $d->read())
  1671. {
  1672. $entry=str_replace(".php","" ,$entry);
  1673. if( is_dir("themes/$entry") and $entry != "." and $entry != ".." and is_file("themes/$entry/site.css"))
  1674. {
  1675. print "<option value='$entry'>$entry</option>\n";
  1676. }
  1677. }
  1678. print "</select></td></tr>\n";
  1679. }
  1680. if ( $role >= "2" ){print "<tr><td>$text[image]</td><td> <input type='file' id='img' name='img'/> $text[maxfilesize] $text_upload_max_filesize<input type='hidden' name='MAX_FILE_SIZE' value='$form_upload_max_filesize' /></td></tr>\n";}
  1681. print "<tr><td colspan='2'>$text[description]</td></tr>\n";
  1682. print "<tr><td colspan='2'><textarea name='data' rows='20' cols='60'></textarea></td></tr>\n";
  1683. print "<tr><td colspan='2'><input type='button' value='$text[newuser]' id='adduser' onclick=\"validate(this.form)\" class='button'/> <input type='reset' value='$text[reset]' class='button'/></td></tr>\n";
  1684. print "</table></form>\n";
  1685. print "$bbcode";
  1686. }
  1687. //}}}
  1688. //{{{Edit user
  1689. if ( "$page" == "edituser" and ( "$role" >= "3" or $_REQUEST['id'] == $userid ))
  1690. {
  1691. print "<script type='text/javascript'>
  1692. function validate(form)
  1693. {
  1694. error=\"\";
  1695. if ( form.name.value == \"\" )
  1696. { error=\"".str_replace(":",","," ".$main->edit_array( $text['name'])." ")."\";
  1697. }
  1698. if ( form.pwd1.value != form.pwd2.value )
  1699. { error=error+\"".str_replace(":",","," ".$main->edit_array( $text['passwd'])." ")."\";
  1700. }
  1701. if ( form.email.value == \"\" )
  1702. { error=error+\"".str_replace(":",","," ".$main->edit_array( $text['email'])." ")."\";
  1703. }
  1704. if (error != '' )
  1705. {
  1706. error=error.replace(\":\", \",\");
  1707. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  1708. return;
  1709. }
  1710. else
  1711. {
  1712. form.submit();
  1713. }
  1714. }
  1715. </script>";
  1716. $myhomeid=$userid;if ( isset($_REQUEST['id'])){$myhomeid=$_REQUEST['id'];}
  1717. $usertable = $main->getuser($myhomeid);
  1718. $utext=$main->edit_array($usertable->records[0]);
  1719. print "<form enctype='multipart/form-data' action='?page=saveuser' method='post'><p><input type='hidden' name='rid' value='$requestid' /></p><table summary='add user'>\n";
  1720. print "<tr><td colspan='3'><span class=\"headline\"><b>$text[edituser]</b></span></td></tr>\n";
  1721. if( "$role" >= "3" )
  1722. {
  1723. $selected="";
  1724. print "<tr><td>$text[role]</td><td>\n";
  1725. print "<select name='role'>\n";
  1726. if ( "$utext[role]" == "0" ){$selected="selected='selected'";}else{$selected="";}
  1727. print "<option $selected value='0'>$text[noaccess]</option>\n";
  1728. if ( "$utext[role]" == "1" ){$selected="selected='selected'";}else{$selected="";}
  1729. print "<option $selected value='1'>$text[limiteduser]</option>\n";
  1730. if ( "$utext[role]" == "2" ){$selected="selected='selected'";}else{$selected="";}
  1731. print "<option $selected value='2'>$text[normaluser]</option>\n";
  1732. if ( "$utext[role]" == "3" ){$selected="selected='selected'";}else{$selected="";}
  1733. print "<option $selected value='3'>$text[moderator]</option>\n";
  1734. if ( "$utext[role]" == "4" ){$selected="selected='selected'";}else{$selected="";}
  1735. if( "$role" == "4" ){print "<option $selected value='4'>$text[admin]</option>\n";}
  1736. print "</select></td></tr>\n";
  1737. }
  1738. else
  1739. {
  1740. print "<input type='hidden' name='role' value='$utext[role]' />";
  1741. }
  1742. print "<tr><td>$text[name]</td><td><input name='name' type='text' id='name' value='$utext[name]' /></td></tr>\n";
  1743. print "<tr><td>$text[username]</td><td>$utext[user]</td></tr>\n";
  1744. print "<tr><td>$text[passwd]</td><td><input name='pwd1' type='password' id='pwd1'/> $text[verify]<input name='pwd2' type='password' id='pwd2'/></td></tr>\n";
  1745. print "<tr><td>$text[email]</td><td><input name='email' type='text' id='email' value='$utext[email]' /></td></tr>\n";
  1746. print "<tr><td>$text[homepageheader]</td><td><input name='homepage' type='text' id='homepage' value='$utext[homepage]'/></td></tr>\n";
  1747. print "<tr><td>$text[lang]</td><td>\n";
  1748. print "<select name='lang'>\n";
  1749. $d=dir("lang");
  1750. while($entry = $d->read())
  1751. {
  1752. $entry_path = "lang/$entry";
  1753. if( is_file("lang/$entry") and substr_count($entry, 'mod_') == 0 )
  1754. {
  1755. $entry=str_replace(".php","",$entry);
  1756. $selected="";
  1757. if ( $utext['lang'] == $entry ){$selected=" selected='selected'";}
  1758. if ( $text["lang$entry"] != "" )
  1759. {
  1760. print "<option value='$entry'$selected>".$text["lang$entry"]."</option>\n";
  1761. }
  1762. else
  1763. {
  1764. print "<option value='$entry'$selected>$entry</option>\n";
  1765. }
  1766. }
  1767. }
  1768. print "</select></td></tr>\n";
  1769. print "<tr><td>$text[nrofnews]</td><td>\n";
  1770. print "<select name='nr'>";
  1771. $selected="";$nrselect=$newscol * 5;if ( $utext['nr'] == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1772. $selected="";$nrselect=$newscol * 10;if ( $utext['nr'] == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1773. $selected="";$nrselect=$newscol * 20;if ( $utext['nr'] == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1774. $selected="";$nrselect=$newscol * 40;if ( $utext['nr'] == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1775. $selected="";$nrselect=$newscol * 80;if ( $utext['nr'] == $nrselect ){$selected=" selected='selected'";};print "<option value='$nrselect'$selected>$nrselect</option>\n";
  1776. print "</select></td></tr>\n";
  1777. if ( $allowusertheme == "true" )
  1778. {
  1779. print "<tr><td>$text[theme]</td><td><select name='usetheme'>\n";
  1780. $d=dir("themes");
  1781. $curtheme=$utext['theme'];;
  1782. print "<option value='default'>$text[default]</option>\n";
  1783. while($entry = $d->read())
  1784. {
  1785. $entry=str_replace(".php","" ,$entry);
  1786. if( is_dir("themes/$entry") and $entry != "." and $entry != ".." and is_file("themes/$entry/site.css"))
  1787. {
  1788. $selected="";
  1789. if ($entry == $curtheme ){$selected="selected=selected";}
  1790. print "<option value='$entry' $selected>$entry</option>\n";
  1791. }
  1792. }
  1793. print "</select></td></tr>\n";
  1794. }
  1795. if ( "$role" >= "2" )
  1796. {
  1797. print "<tr><td>$text[replaceimg]</td><td> <input type='file' id='img' name='img'/> $text[maxfilesize] $text_upload_max_filesize<input type='hidden' name='MAX_FILE_SIZE' value='$form_upload_max_filesize' /></td></tr>\n";
  1798. if ( isset($utext['img']) and $utext['img'] != "")
  1799. {
  1800. print "<tr><td><label for='delimg'>$text[removeimg]</label></td><td><input type='checkbox' id='delimg' name='delimg'/>\n";
  1801. print "<img src='thumb/user/$utext[id]/$utext[img]' alt=''/>\n";
  1802. }
  1803. }
  1804. print "</td></tr><tr><td colspan='2'>$text[description]</td></tr>\n";
  1805. print "<tr><td colspan='2'><textarea name='data' rows='20' cols='60'>$utext[data]</textarea></td></tr>\n";
  1806. print "<tr><td colspan='2'><input type='hidden' name='id' value='$utext[id]' />";
  1807. print "<input type='hidden' name='user' value='$utext[user]' /><input type='button' value='$text[saveuser]' id='adduser' onclick=\"validate(this.form)\" class='button'/> <input type='reset' value='$text[reset]' class='button'/></td></tr>\n";
  1808. print "</table></form>\n";
  1809. print "$bbcode";
  1810. }
  1811. //}}}
  1812. //{{{ Edit Menu
  1813. if ( $page == "editmenu" and $role >= "3" )
  1814. {
  1815. if ( isset($_REQUEST['do']))
  1816. {
  1817. if ($_REQUEST['do'] == "save" )
  1818. {
  1819. if ( isset($_REQUEST['id']) and isset($_REQUEST['access']) and isset($_REQUEST['order']) and isset($_REQUEST['parent']) )
  1820. {
  1821. $main->savemenu($_REQUEST['id'], $_REQUEST['access'], $_REQUEST['order'], $_REQUEST['parent']);
  1822. }
  1823. }
  1824. }
  1825. $menuitems=$main->getallmenu();
  1826. print "<form enctype='multipart/form-data' action='?page=editmenu' method='post'>";
  1827. print "<table>";
  1828. print "<tr><td colspan='5'><span class=\"headline\"><b>$text[editmenu]</b></span></td></tr>\n";
  1829. print "<tr>";
  1830. print "<th class='title'>$text[menuid]</th>";
  1831. print "<th class='title'>$text[access]</th>";
  1832. print "<th class='title'>$text[order]</th>";
  1833. print "<th class='title'>$text[parent]</th>";
  1834. print "<th class='title' colspan='2'>$text[menutext]</th>";
  1835. print "</tr>";
  1836. $togler=1;
  1837. foreach ($menuitems->records as $item )
  1838. {
  1839. $class="";
  1840. if ( $togler % 2 == 0 )
  1841. {
  1842. $class="class='light'";
  1843. }
  1844. print "<tr>";
  1845. if ( isset($_REQUEST['editid']) and $_REQUEST['editid'] == $item['id'] )
  1846. {
  1847. print "<td $class>$item[id]";
  1848. print "<input type='hidden' name='id' value='$item[id]' /><input type='hidden' name='do' value='save' /><input type='hidden' name='rid' value='$requestid' /></td>";
  1849. print "<td $class><select name='access'>";
  1850. $selected="";if( "$item[access]" == "0" ){$selected="selected='selected'";}print "<option $selected value='0'>$text[noaccess]</option>\n";
  1851. $selected="";if( "$item[access]" == "1" ){$selected="selected='selected'";}print "<option $selected value='1'>$text[limiteduser]</option>\n";
  1852. $selected="";if( "$item[access]" == "2" ){$selected="selected='selected'";}print "<option $selected value='2'>$text[normaluser]</option>\n";
  1853. $selected="";if( "$item[access]" == "3" ){$selected="selected='selected'";}print "<option $selected value='3'>$text[moderator]</option>\n";
  1854. $selected="";if( "$item[access]" == "4" ){$selected="selected='selected'";}print "<option $selected value='4'>$text[admin]</option>\n";
  1855. print "</select></td>";
  1856. print "<td $class><input name='order' type='text' id='word' alt='word' value='$item[order]' size='2'/></td>";
  1857. print "<td $class><input name='parent' type='text' id='word' alt='word' value='$item[parent]' size='2'/></td>";
  1858. if ( isset($text["$item[data]"]))
  1859. {
  1860. print "<td $class>".$text["$item[data]"]."</td>";
  1861. }
  1862. else
  1863. {
  1864. print "<td $class>$item[data]</td>";
  1865. }
  1866. print "<td $class><input type='submit' value='$text[savemenu]' id='savemenu' class='button'/><input type='reset' value='$text[reset]' class='button'/>";
  1867. print "</td>";
  1868. }
  1869. else
  1870. {
  1871. print "<td $class>$item[id]</td>";
  1872. print "<td $class>";
  1873. if( "$item[access]" == "0" ){print "$text[noaccess]\n";}
  1874. elseif( "$item[access]" == "1" ){print "$text[limiteduser]\n";}
  1875. elseif( "$item[access]" == "2" ){print "$text[normaluser]\n";}
  1876. elseif( "$item[access]" == "3" ){print "$text[moderator]\n";}
  1877. elseif( "$item[access]" == "4" ){print "$text[admin]\n";}
  1878. else{print "$item[access]";}
  1879. print "</td>";
  1880. print "<td $class>$item[order]</td>";
  1881. print "<td $class>$item[parent]</td>";
  1882. if ( isset($text["$item[data]"]))
  1883. {
  1884. print "<td $class>".$text["$item[data]"]."</td>";
  1885. }
  1886. else
  1887. {
  1888. print "<td $class>$item[data]</td>";
  1889. }
  1890. print "<td $class><a $class href='?page=editmenu&amp;editid=$item[id]&amp;rid=$requestid'>$text[edit]</a></td>";
  1891. }
  1892. print "</tr>";
  1893. $togler++;
  1894. }
  1895. print "</table></form>";
  1896. }
  1897. //}}}
  1898. //{{{ Edit abbr
  1899. if ( "$page" == "editabbr" and $role >= "3" )
  1900. {
  1901. if (isset($_REQUEST['do']))
  1902. {
  1903. if ($_REQUEST['do'] == "updateall")
  1904. {
  1905. $nr=$main->getnrabbrnews();
  1906. $donr=30;
  1907. for ($i = 0; $i <= $nr ; $i+=$donr)
  1908. {
  1909. $news=$main->getabbrnews($i,$donr);
  1910. $news=$main->edit_array($news);
  1911. $news=$main->clean_array($news , false );
  1912. foreach ($news['records'] as $onenews )
  1913. {
  1914. $main->saveabbrnews($onenews['id'], $onenews['data'], $onenews['data2']);
  1915. }
  1916. }
  1917. $nrc=$main->getnrabbrcomments();
  1918. for ($i = 0; $i <= $nr ; $i+=$donr)
  1919. {
  1920. $comments=$main->getabbrcomments($i,$donr);
  1921. $comments=$main->edit_array($comments);
  1922. $comments=$main->clean_array($comments, false );
  1923. foreach ($comments['records'] as $onenews )
  1924. {
  1925. $main->saveabbrcomment($onenews['id'], $onenews['data']);
  1926. }
  1927. }
  1928. }
  1929. }
  1930. $order="id";if ( isset($_REQUEST['orderabbr'])){$order=$_REQUEST['orderabbr'];$_SESSION['abbrorder']=$order;}elseif(isset($_SESSION['abbrorder'])){$order=$_SESSION['abbrorder'];}
  1931. $abbrlist = $main->getabbr($order);
  1932. $togler=1;
  1933. $class="class='title'";
  1934. print "<script type='text/javascript'>
  1935. function validate(form)
  1936. {
  1937. error=\"\";
  1938. if ( form.word.value == \"\" )
  1939. {
  1940. error=\"".str_replace(":",","," ".$main->edit_array( $text['abbrword']).", ")."\";
  1941. }
  1942. if ( form.title.value == \"\" )
  1943. {
  1944. error=error+\"".str_replace(":",""," ".$main->edit_array( $text['abbrtitle'])." ")."\";
  1945. }
  1946. if (error != '' )
  1947. {
  1948. error=error.replace(\":\", \",\");
  1949. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  1950. return;
  1951. }
  1952. else
  1953. {
  1954. form.submit();
  1955. }
  1956. }
  1957. </script>";
  1958. print "<table width='100%' summary='users'>\n";
  1959. print "<tr><td colspan='5'><span class=\"headline\"><b>$text[editabbr]</b></span></td></tr>\n";
  1960. print "<tr><th $class><a $class href='?page=editabbr&amp;orderabbr=type&amp;rid=$requestid'>$text[abbrtype]</a></th>";
  1961. print "<th $class><a $class href='?page=editabbr&amp;orderabbr=word&amp;rid=$requestid'>$text[abbrword]</a></th>";
  1962. print "<th $class><a $class href='?page=editabbr&amp;orderabbr=title&amp;rid=$requestid'>$text[abbrtitle]</a></th>";
  1963. print "<th colspan='2' $class><a $class href='?page=editabbr&amp;order=data&amp;rid=$requestid'>$text[abbrlink]</a></th></tr>\n";
  1964. foreach ($abbrlist->records as $abbr )
  1965. {
  1966. if (!isset($abbr['data']))
  1967. {
  1968. $abbr['data']="";
  1969. }
  1970. if ( isset($_REQUEST['editid']) and $_REQUEST['editid'] == $abbr['id'] )
  1971. {
  1972. print "<tr>\n";
  1973. print "<td colspan='5'>";
  1974. print "<form enctype='multipart/form-data' action='?page=editabbr' method='post'>";
  1975. print "<p><input type='hidden' name='id' value='$abbr[id]' /><input type='hidden' name='do' value='save' /><input type='hidden' name='rid' value='$requestid' />";
  1976. $selected="";
  1977. print "<select name=type>";
  1978. #if( $abbr['type'] == "1" ){$selected="selected='selected'";}else{$selected="";}print "<option $selected value='1'>$text[abbrtypeabbr]</option>";
  1979. if( $abbr['type'] == "2" ){$selected="selected='selected'";}else{$selected="";}print "<option $selected value='2'>$text[abbrtypeacronym]</option>";
  1980. if( $abbr['type'] == "3" ){$selected="selected='selected'";}else{$selected="";}print "<option $selected value='3'>$text[abbrtypelink]</option>";
  1981. print "</select>";
  1982. print "<input name='word' type='text' id='word' alt='word' value='$abbr[word]' size='12'/>";
  1983. print "<input name='title' type='text' id='title' alt='title' size='29' value='$abbr[title]'/>";
  1984. print "<input name='abbrdata' type='text' id='abbrdata' alt='abbrdata' size='29' value='$abbr[data]'/>";
  1985. print "<input type='button' value='$text[saveabbr]' id='saveabbr' onclick=\"validate(this.form)\" class='button'/>";
  1986. print "</p></form></td></tr>\n";
  1987. }
  1988. else
  1989. {
  1990. $class="";
  1991. if ( $togler % 2 == 0 )
  1992. {
  1993. $class="class='light'";
  1994. }
  1995. print "<tr>";
  1996. print "<td $class>";
  1997. #if( $abbr['type'] == "1" ){print "$text[abbrtypeabbr]";}
  1998. if( $abbr['type'] == "2" ){print "$text[abbrtypeacronym]";}
  1999. if( $abbr['type'] == "3" ){print "$text[abbrtypelink]";}
  2000. print "&nbsp;</td>";
  2001. print "<td $class>$abbr[word]&nbsp;</td>";
  2002. print "<td $class>$abbr[title]&nbsp;</td>";
  2003. print "<td $class>$abbr[data]&nbsp;</td>";
  2004. print "<td $class><a $class href='?page=editabbr&amp;editid=$abbr[id]&amp;rid=$requestid'>$text[edit]</a>&nbsp;<a $class href='?page=editabbr&amp;deleteid=$abbr[id]&amp;rid=$requestid'>$text[delete]</a></td>";
  2005. print "</tr>";
  2006. }
  2007. $togler++;
  2008. }
  2009. if (!isset($_REQUEST['editid']))
  2010. {
  2011. print "<tr>\n";
  2012. print "<td colspan='5'>";
  2013. print "<form enctype='multipart/form-data' action='?page=editabbr' method='post'>";
  2014. print "<p><input type='hidden' name='do' value='add' /><input type='hidden' name='rid' value='$requestid' />";
  2015. $selected="";
  2016. print "<select name=type>";
  2017. #print "<option $selected value='1'>$text[abbrtypeabbr]</option>";
  2018. print "<option $selected value='2'>$text[abbrtypeacronym]</option>";
  2019. print "<option $selected value='3'>$text[abbrtypelink]</option>";
  2020. print "</select>";
  2021. print "<input name='word' type='text' id='word' alt='word' size='12'/>";
  2022. print "<input name='title' type='text' id='title' alt='title' size='29'/>";
  2023. print "<input name='abbrdata' type='text' id='abbrdata' alt='abbrdata' size='29'/>";
  2024. print "<input type='button' value='$text[addabbr]' id='saveabbr' onclick=\"validate(this.form)\" class='button'/>";
  2025. print "</p></form></td></tr>\n";
  2026. }
  2027. print "</table>";
  2028. print "<a href='?page=editabbr&amp;do=updateall&amp;rid=$requestid'>$text[updateall]</a>";
  2029. }
  2030. //}}}
  2031. //{{{ List users
  2032. if ( "$page" == "listusers" and ( "$role" >= "1" or $allowanonuserhome == "true") )
  2033. {
  2034. $_SESSION['lastpage']=$page;
  2035. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  2036. $nr=$nr*2;
  2037. $uorder="name";
  2038. if (isset($_REQUEST['uorder']))
  2039. {
  2040. if ($_REQUEST['uorder'] == 1 ){$uorder="name";}
  2041. if ($_REQUEST['uorder'] == 2 ){$uorder="role";}
  2042. if ($_REQUEST['uorder'] == 3 ){$uorder="email";}
  2043. if ($_REQUEST['uorder'] == 4 ){$uorder="nrlogins desc";}
  2044. }
  2045. $userlist = $main->getuserlist( $start , $nr, $uorder);
  2046. $nrofusers = $main->getnruserlist( );
  2047. $nrofusers = $nrofusers->records[0]['nr'];
  2048. $colls=3;
  2049. print "<table width='100%' summary='users'>\n";
  2050. if ($role >= 3)
  2051. {
  2052. $colls=6;
  2053. }
  2054. elseif ($role >= 2)
  2055. {
  2056. $colls=5;
  2057. }
  2058. print "<tr><td colspan='$colls'><span class=\"headline\"><b>$text[listusers]</b></span></td></tr>\n";
  2059. $togler=0;
  2060. print "<tr><th class=\"title\"><a href='?page=listusers&amp;start=$start&amp;nr=$nr&amp;rid=$requestid&amp;uorder=1' class=\"title\"> $text[name]</a></th>
  2061. <th class=\"title\">$text[haveinfo]</th>
  2062. <th class=\"title\"><a href='?page=listusers&amp;start=$start&amp;nr=$nr&amp;rid=$requestid&amp;uorder=2' class=\"title\">$text[role]</a></th>";
  2063. if ( $role >= "2" ){print "<th class=\"title\"><a href='?page=listusers&amp;start=$start&amp;nr=$nr&amp;rid=$requestid&amp;uorder=3' class=\"title\">$text[email]</a></th>
  2064. <th class=\"title\"><a href='?page=listusers&amp;start=$start&amp;nr=$nr&amp;rid=$requestid&amp;uorder=4' class=\"title\">$text[nrlogins]</a></th>";}
  2065. if ( $role >= "3" ){print "<th class=\"title\">$text[actions]</th>";}
  2066. print "</tr>";
  2067. foreach( $userlist->records as $utext )
  2068. {
  2069. $class="";
  2070. if ( $togler % 2 == 1 )
  2071. {
  2072. $class="class='light'";
  2073. }
  2074. print "<tr>\n";
  2075. print "<td $class><a $class href='?page=userhome&amp;id=$utext[id]&amp;rid=$requestid'>$utext[name]</a></td>\n";
  2076. print "<td $class>";
  2077. if ($utext['data'] != "" )
  2078. {
  2079. print "<img src='images/havetext.gif' alt='$text[description]'/>";
  2080. }
  2081. if ( $utext['img'] != "")
  2082. {
  2083. print "<img src='images/havephoto.gif' alt='$text[image]' />";
  2084. }
  2085. if ( $role >= 3 and $utext['login'] == "" )
  2086. {
  2087. print "<img src='images/nologin.gif' alt='$text[nologin]' />";
  2088. }
  2089. print "</td>\n";
  2090. if( $utext['role'] == 0 ){print "<td $class>$text[noaccess]</td>\n";}
  2091. if( $utext['role'] == 1 ){print "<td $class>$text[limiteduser]</td>\n";}
  2092. if( $utext['role'] == 2 ){print "<td $class>$text[normaluser]</td>\n";}
  2093. if( $utext['role'] == 3 ){print "<td $class>$text[moderator]</td>\n";}
  2094. if( $utext['role'] == 4 ){print "<td $class>$text[admin]</td>\n";}
  2095. if ( $role >= "2" )
  2096. {
  2097. print "<td $class ><a $class href='mailto:$utext[email]'>$utext[email]</a></td>\n";
  2098. print "<td $class >$utext[nrlogins]</td>\n";
  2099. }
  2100. if ( $role >= "3" )
  2101. {
  2102. print "<td $class><a $class href='?page=edituser&amp;id=$utext[id]&amp;rid=$requestid'>$text[edit]</a> <a $class href='?page=rmuser&amp;id=$utext[id]&amp;rid=$requestid'>$text[remove]</a> <a $class href='?page=deluser&amp;id=$utext[id]&amp;rid=$requestid'>$text[delete]</a></td>\n";
  2103. }
  2104. $togler++;
  2105. print "</tr>\n";
  2106. }
  2107. print "<tr><td colspan='$colls' class='title'><span class=\"small\">$text[nrusers]&nbsp;$nrofusers&nbsp;&nbsp;\n";
  2108. if ( $start > 0 )
  2109. {
  2110. $pstart=$start-$nr;if ($pstart < 0 ){$pstart=0;}
  2111. print "<a href='?page=listusers&amp;start=$pstart&amp;nr=$nr&amp;rid=$requestid' class='title'>$text[prev]</a>\n";
  2112. }
  2113. else
  2114. {
  2115. print " $text[prev] ";
  2116. }
  2117. print "&nbsp;|&nbsp;";
  2118. if ( $nrofusers > $nr+$start )
  2119. {
  2120. $nstart=$start+$nr;
  2121. print "<a href='?page=listusers&amp;start=$nstart&amp;nr=$nr&amp;rid=$requestid' class='title'>$text[next]</a>\n";
  2122. }
  2123. else
  2124. {
  2125. print " $text[next] ";
  2126. }
  2127. print "</span></td></tr>\n";
  2128. print "</table>\n";
  2129. }
  2130. //}}}
  2131. //{{{ Referer
  2132. if ( "$page" == "referer" and "$role" >= "3" )
  2133. {
  2134. $referer=$main->getReferer();
  2135. print "<table width='100%' summary='referer'>\n";
  2136. print "<tr><td colspan='2'><span class=\"headline\"><b>$text[referer]</b></span></td></tr>\n";
  2137. $togler=1;
  2138. print "<tr><td class='title'><span class=\"small\">$text[counter]</span></td><td class='title'><span class=\"small\">$text[referer]:</span></td></tr>";
  2139. foreach( $referer->records as $utext )
  2140. {
  2141. $class="";
  2142. if ( $togler % 2 == 0 )
  2143. {
  2144. $class="class='light'";
  2145. }
  2146. print "<tr>\n";
  2147. print "<td $class><span class=\"small\"> \n";
  2148. print "$utext[nr]\n";
  2149. print "</span></td><td $class><span class=\"small\">\n";
  2150. print "<a $class href='$utext[referer]'>$utext[referer]</a>\n";
  2151. print "</span></td></tr>\n";
  2152. $togler++;
  2153. }
  2154. print "</table>\n";
  2155. }
  2156. //}}}
  2157. //{{{ Borwser statistic
  2158. if ( $page == "browserstat" and $role >= 3 )
  2159. {
  2160. print "<span class=\"headline\"><b>$text[browserstat]:</b></span><br /><br />";
  2161. print "<table width='100%' summary='$text[browserstat]'>\n";
  2162. $brosterstat=$main->getbrowserstat("0");
  2163. $togler=false;
  2164. $class="class=\"title\"";
  2165. print "<tr><th $class>$text[yearmonth]</th>
  2166. <th $class>$text[pageviews]</th>
  2167. <th $class>$text[browser]</th>
  2168. <th $class>$text[version]</th>
  2169. </tr> \n ";
  2170. foreach( $brosterstat->records as $bstat )
  2171. {
  2172. if ($togler){$class="class='light'";}else{$class="";}
  2173. print "<tr><td $class>$bstat[year]-$bstat[month]</td>
  2174. <td $class>$bstat[hits]</td>
  2175. <td $class>$bstat[browser]</td>
  2176. <td $class>$bstat[version]</td>
  2177. ";
  2178. print "</tr> \n ";
  2179. $togler=!$togler;
  2180. }
  2181. print "</table>\n";
  2182. print "<br /><br /><span class=\"headline\"><b>$text[crawlers]</b></span><br /><br />";
  2183. print "<table width='100%' summary='$text[browserstat]'>\n";
  2184. $brosterstat=$main->getbrowserstat("1");
  2185. $togler=false;
  2186. $class="class=\"title\"";
  2187. print "<tr><th $class>$text[yearmonth]</th>
  2188. <th $class>$text[pageviews]</th>
  2189. <th $class>$text[browser]</th>
  2190. <th $class>$text[version]</th>
  2191. </tr> \n ";
  2192. foreach( $brosterstat->records as $bstat )
  2193. {
  2194. if ($togler){$class="class='light'";}else{$class="";}
  2195. print "<tr><td $class>$bstat[year]-$bstat[month]</td>
  2196. <td $class>$bstat[hits]</td>
  2197. <td $class>$bstat[browser]</td>
  2198. <td $class>$bstat[version]</td>";
  2199. print "</tr> \n ";
  2200. $togler=!$togler;
  2201. }
  2202. print "</table>\n";
  2203. print "<br /><br /><span class=\"headline\"><b>$text[platform]</b></span><br /><br />";
  2204. print "<table width='100%' summary='$text[browserstat]'>\n";
  2205. $brosterstat=$main->getbrowserstat("3");
  2206. $togler=false;
  2207. $class="class=\"title\"";
  2208. print "<tr><th $class>$text[yearmonth]</th>
  2209. <th $class>$text[pageviews]</th>
  2210. <th $class>$text[platform]</th>
  2211. </tr> \n ";
  2212. foreach( $brosterstat->records as $bstat )
  2213. {
  2214. if ($togler){$class="class='light'";}else{$class="";}
  2215. print "<tr><td $class>$bstat[year]-$bstat[month]</td>
  2216. <td $class>$bstat[hits]</td>
  2217. <td $class>$bstat[platform]</td>";
  2218. print "</tr> \n ";
  2219. $togler=!$togler;
  2220. }
  2221. print "</table>\n";
  2222. }
  2223. //}}}
  2224. //{{{ handle sessions
  2225. if ($page == "sessions" and $role >= 3 and $usedbsessions )
  2226. {
  2227. if (isset($_REQUEST['do']) and isset($_REQUEST['sid']))
  2228. {
  2229. $do=$_REQUEST['do'];
  2230. $sid=$_REQUEST['sid'];
  2231. if ( $do == "del")
  2232. {
  2233. $session->destroy($sid);
  2234. }
  2235. }
  2236. $activesessios=$main->run_query("select s.session_id, s.session_expires, s.page, s.ip , u.name, u.role, s.hits from sessions s join user u on s.user = u.id order by s.session_expires desc;");
  2237. print "<span class=\"headline\"><b>$text[sessions]</b></span><br /><br />";
  2238. print "<b>Current time:</b> ".strftime("%Y-%m-%d %T",time())."";
  2239. print "<table width='100%' summary='$text[sessions]'>\n";
  2240. $brosterstat=$main->getbrowserstat("0");
  2241. $togler=false;
  2242. $class="class=\"title\"";
  2243. print "<tr><th $class>$text[name]</th>
  2244. <th $class>$text[role]</th>
  2245. <th $class>$text[pageviews]</th>
  2246. <th $class>$text[ip]</th>
  2247. <th $class>$text[lastpage]</th>
  2248. <th $class>$text[expires]</th>
  2249. <th $class>$text[actions]</th>
  2250. </tr> \n ";
  2251. foreach( $activesessios->records as $csessios )
  2252. {
  2253. if ($togler){$class="class='light'";}else{$class="";}
  2254. $date=strftime("%Y-%m-%d %T",$csessios['session_expires']);
  2255. print "<tr><td $class>$csessios[name]</td>";
  2256. if( $csessios['role'] == 0 ){print "<td $class>$text[noaccess]</td>\n";}
  2257. if( $csessios['role'] == 1 ){print "<td $class>$text[limiteduser]</td>\n";}
  2258. if( $csessios['role'] == 2 ){print "<td $class>$text[normaluser]</td>\n";}
  2259. if( $csessios['role'] == 3 ){print "<td $class>$text[moderator]</td>\n";}
  2260. if( $csessios['role'] == 4 ){print "<td $class>$text[admin]</td>\n";}
  2261. print "<td $class>$csessios[hits]</td>
  2262. <td $class>$csessios[ip]</td>
  2263. <td $class>$csessios[page]</td>
  2264. <td $class>$date</td>
  2265. <td $class><a $class href='?page=sessions&amp;do=del&amp;sid=$csessios[session_id]'>$text[terminate]</a></td>";
  2266. print "</tr> \n ";
  2267. $togler=!$togler;
  2268. }
  2269. print "</table>\n";
  2270. }
  2271. //}}}
  2272. //{{{ manage init pages
  2273. if ( "$page" == "manageinitpages" and $role >= "3" )
  2274. {
  2275. $_SESSION['lastpage']=$page;
  2276. $start="0";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  2277. $news=$main->getnews($role, 4, $start, $nr );
  2278. $nrofnews = $main->getnrnews( $role, 4);
  2279. $nrofnews = $nrofnews->records[0]['nr'];
  2280. $main->printnews( $news,$nrofnews,$role,$userid,$start,$nr,$page,"" );
  2281. }
  2282. //}}}
  2283. //{{{ Optimize table
  2284. if ($page == "optimizetables")
  2285. {
  2286. $main->optimizetables();
  2287. }
  2288. //}}}
  2289. //{{{ Plugin
  2290. if ( "$page" == "plugin" and $enableplugin == "true" )
  2291. {
  2292. if( isset($_REQUEST['plug']))
  2293. {
  2294. $pluginname=$_REQUEST['plug'];
  2295. if (isset($plugins[$pluginname]))
  2296. {
  2297. $plugin=$plugins[$pluginname];
  2298. $plugin->execute($main);
  2299. }
  2300. }
  2301. }
  2302. //}}}
  2303. //{{{ Edit news
  2304. if ( "$page" == "editnews" and "$role" >= "1" )
  2305. {
  2306. print "<script type='text/javascript'>
  2307. function validate(form)
  2308. {
  2309. error=\"\";
  2310. if ( form.header.value == \"\" )
  2311. {
  2312. error=\"".str_replace(":",","," ".$main->edit_array( $text['header'])." ")."\";
  2313. }
  2314. if ( form.news.value == \"\" )
  2315. {
  2316. error=error+\"".str_replace(":",""," ".$main->edit_array( $text['newstext'])." ")."\";
  2317. }
  2318. if (error != '' )
  2319. {
  2320. error=error.replace(\":\", \",\");
  2321. alert('".$main->edit_array( $text['missingfields'])."'+' '+error);
  2322. return;
  2323. }
  2324. else
  2325. {
  2326. form.submit();
  2327. }
  2328. }
  2329. </script>";
  2330. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}
  2331. $news = $main->geteditnews( $id );
  2332. $news = $main->edit_array($news);
  2333. $utext=$news['records']['0'];
  2334. $selected="";
  2335. print "<form enctype='multipart/form-data' action='?page=savenews' method='post'><p><input type='hidden' name='rid' value='$requestid' /></p>\n";
  2336. print "<table summary='edit news'><tr><td valign='top'><label for='access'>$text[access]</label></td><td valign='top'><select name='access'>\n";
  2337. if ( "$utext[access]" == "0" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" )){print "<option $selected value='0'>$text[access0]</option>\n";}
  2338. if ( "$utext[access]" == "1" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" or ($allowuserstoaddannonnews and $role >= "1" )){print "<option $selected value='1'>$text[access1]</option>\n";}
  2339. if ( "$utext[access]" == "2" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "2" ){print "<option $selected value='2'>$text[access2]</option>\n";}
  2340. if ( "$utext[access]" == "3" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "3" ){print "<option $selected value='3'>$text[access3]</option>\n";}
  2341. if ( "$utext[access]" == "4" ){$selected="selected='selected'";}else{$selected="";}if ( $role >= "4" ){print "<option $selected value='4'>$text[access4]</option>\n";}
  2342. print "</select></td></tr>\n";
  2343. if ( "$role" >= "3" )
  2344. {
  2345. if ( "$utext[order]" == "1" ){$selected="selected='true'";}else{$selected="";}
  2346. print "<tr><td valign='top'><label for='order'>$text[sticky]</label></td><td valign='top'><select name='order'>\n";
  2347. print "<option $selected value='1'>$text[sticky1]</option>\n";
  2348. if ( "$utext[order]" == "0" ){$selected="selected='true'";}else{$selected="";}
  2349. print "<option $selected value='0'>$text[sticky0]</option>\n";
  2350. print "</select></td></tr>\n";
  2351. }
  2352. print "<tr><td>$text[newstype]</td><td> <select name='type'>\n";
  2353. if ( "$utext[type]" == "1" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "2" ){print "<option $selected value='1'>$text[type1]</option>\n";}
  2354. if ( "$utext[type]" == "2" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "2" ){print "<option $selected value='2'>$text[type2]</option>\n";}
  2355. if ( "$utext[type]" == "3" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "3" ){print "<option $selected value='3'>$text[type3]</option>\n";}
  2356. if ( "$utext[type]" == "4" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "3" and $initpage == "true" ){print "<option $selected value='4'>$text[type4]</option>\n";}
  2357. if ( "$utext[type]" == "5" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "1" ){print "<option $selected value='5'>$text[type5]</option>\n";}
  2358. if ( "$utext[type]" == "6" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "1" ){print "<option $selected value='6'>$text[type6]</option>\n";}
  2359. if ( "$utext[type]" == "7" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "3" ){print "<option $selected value='7'>$text[type7]</option>\n";}
  2360. if ( "$utext[type]" == "8" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "3" ){print "<option $selected value='8'>$text[type8]</option>\n";}
  2361. if ( "$utext[type]" == "9" ){$selected="selected='true'";}else{$selected="";}if ( $role >= "2" ){print "<option $selected value='9'>$text[type9]</option>\n";}
  2362. print "</select></td></tr>";
  2363. $category = $main->getAllCategories();
  2364. print "<tr><td valign='top'>$text[category]</td><td valign='top'> <select name='category'>\n";
  2365. foreach( $category->records as $item )
  2366. {
  2367. $catitem=str_replace(" ","&nbsp;",$item['name']);
  2368. if ( isset($text[$item['name']])){$catitem=str_replace(" ","&nbsp;",$text[$item['name']]);}
  2369. $selected="";
  2370. if ( "$utext[category]" == $item['id'] ){$selected="selected='selected'";}else{$selected="";}
  2371. print "<option $selected value='$item[id]'>$catitem</option>\n";
  2372. }
  2373. print "</select><input name='newcategory' type='text' id='newcategory'/></td></tr>\n";
  2374. if ( $role >= "2" )
  2375. {
  2376. print "<tr><td valign='top'><label for='img'>$text[replaceimg]</label></td><td valign='top'><input type='file' id='img' name='img'/> $text[maxfilesize] $text_upload_max_filesize<input type='hidden' name='MAX_FILE_SIZE' value='$form_upload_max_filesize' /></td></tr>\n";
  2377. if ( isset($utext['img']) and $utext['img'] != "")
  2378. {
  2379. print "<tr><td valign='top'><label for='delimg'>$text[removeimg]</label></td><td valign='top'><input type='checkbox' id='delimg' name='delimg'/>\n";
  2380. print "<br /><img src='thumb/news/$utext[id]/$utext[img]' alt='' align='left' />\n";
  2381. print "</td></tr>\n";
  2382. }
  2383. }
  2384. print "<tr><td valign='top'><label for='header'>$text[header]</label></td><td valign='top'><input name='header' type='text' id='header' value='$utext[headline]' /></td></tr>\n";
  2385. print "<tr><td valign='top' colspan='2'><label for='news'>$text[newstext]</label></td></tr>\n";
  2386. print "<tr><td valign='top' colspan='2'><textarea name='news' rows='20' cols='60'>$utext[data]</textarea></td></tr>\n";
  2387. print "<tr><td valign='top' colspan='2'><label for='extnews'>$text[extnewstext]</label></td></tr>\n";
  2388. print "<tr><td valign='top' colspan='2'><textarea name='extnews' rows='20' cols='60'>$utext[data2]</textarea></td></tr>\n";
  2389. print "<tr><td valign='top' colspan='2'><input type='hidden' name='id' value='$id' /><input type='button' value='$text[savenews]' id='savenews' onclick=\"validate(this.form)\" class='button' /> <input type='reset' value='$text[reset]' class='button'/></td></tr>\n";
  2390. print "</table></form>\n";
  2391. print "$bbcode";
  2392. }
  2393. //}}}
  2394. //{{{ Viewnews
  2395. if ( "$page" == "viewnews" )
  2396. {
  2397. $_SESSION['lastpage']=$page;
  2398. $start="";if ( isset($_REQUEST['start']) ){$start=$_REQUEST['start'];}
  2399. $id="";if ( isset($_REQUEST['id']) ){$id=$_REQUEST['id'];}elseif( isset($_SESSION['lastid'])){$id=$_SESSION['lastid'];}
  2400. if ($id != "")
  2401. {
  2402. $news=$main->run_query ("select UNIX_TIMESTAMP(n.date) as date,n.access, n.views , n.owner, n.id, n.headline, n.img, n.data, n.data2, length(data2) as length, u.name, u.role, n.order, n.type , n.votes, n.rating,c.id as catid, c.name as category, (select count(c.toid) from comment c where c.toid=n.id and c.type = 1) as comments from news n, user u, category c where n.owner = u.id and n.id = '$id' and c.id = n.category");
  2403. $main->printnews( $news,"0",$role,$userid,"-1","-1",$page,"" );
  2404. }
  2405. $_SESSION['lastid']=$id;
  2406. }
  2407. //}}}
  2408. //{{{ Cookie information
  2409. if ( $page == "cookie" )
  2410. {
  2411. print "<span class=\"headline\"><b>$text[cookieheader]</b></span><br /><br />$text[cookietext]";
  2412. }
  2413. //}}}
  2414. //{{{ Password recovery
  2415. if ( $page == "pwdrec2" )
  2416. {
  2417. if ( isset($_REQUEST['pwduname']) and isset($_REQUEST['pwdemail']) and $_REQUEST['pwduname'] != "" and $_REQUEST['pwdemail'] != "" )
  2418. {
  2419. $tempuserinfo=$main->run_query("select * from user where email = '$_REQUEST[pwdemail]' and user = '$_REQUEST[pwduname]'");
  2420. }
  2421. else if ( isset($_REQUEST['pwdemail']) and $_REQUEST['pwdemail'] != "" )
  2422. {
  2423. $tempuserinfo=$main->run_query("select * from user where email = '$_REQUEST[pwdemail]'");
  2424. }
  2425. else if ( isset($_REQUEST['pwduname']) and $_REQUEST['pwduname'] != "" )
  2426. {
  2427. $tempuserinfo=$main->run_query("select * from user where user = '$_REQUEST[pwduname]'");
  2428. }
  2429. if ( isset($tempuserinfo) and $tempuserinfo->rows == 1 and $main->isemail($tempuserinfo->records['0']['email']))
  2430. {
  2431. print "<span class=\"headline\"><b>$text[pwdrecovery] (2/2)</b></span><br /><br />";
  2432. print "$text[pwdrecoverytext2]";
  2433. $_SESSION['pwdid']=rand(100000, 999999);
  2434. $xforwardip="";
  2435. if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) and $_SERVER['HTTP_X_FORWARDED_FOR'] != "" )
  2436. {
  2437. $xforwardip=" ($_SERVER[HTTP_X_FORWARDED_FOR])";
  2438. }
  2439. $_SESSION['tempuserlogin']=$tempuserinfo->records['0'];
  2440. $main->sendMail($tempuserinfo->records['0']['email'], $main->edit_array($text['pwdrecoverysubject']." ".$sitetitle),$main->edit_array($sitetitle."<br /><br />".$text['pwdrecoveryemail']." ".$_SESSION['pwdid']."<br />".$text['pwdrecoveryemailbottom']."<br /><br />".$sitetitle."<br /><br />IP= ".$_SERVER['REMOTE_ADDR'].$xforwardip),$adminemail);
  2441. print "<script type='text/javascript'>
  2442. function validate(form)
  2443. {
  2444. error=\"\";
  2445. if ( form.pwdinid.value == \"\" )
  2446. {
  2447. alert('".$main->edit_array( $text['pwdrecoveryerror2'])."');
  2448. return;
  2449. }
  2450. else
  2451. {
  2452. form.submit();
  2453. }
  2454. }
  2455. </script>";
  2456. print "<form enctype='multipart/form-data' action='?page=pwdrec3' method='post'><p><input type='hidden' name='rid' value='$requestid' />\n";
  2457. print "<table summary='pwd recovery'>\n";
  2458. print "<tr><td>$text[pwdrecoveryid]</td><td><input name='pwdinid' type='text' id='pwdinid'/></td></tr>\n";
  2459. print "<tr><td colspan='2'><input type='button' value='$text[pwdrecoverysend]' id='adduser' onclick=\"validate(this.form)\" class='button'/> <input type='reset' value='$text[reset]' class='button'/></td></tr>\n";
  2460. print "</table>\n";
  2461. print "</form>";
  2462. }
  2463. else
  2464. {
  2465. print "$text[pwdrecoveryerror2]<br /><br />";
  2466. $page = "pwdrec";
  2467. }
  2468. }
  2469. if ( $page == "pwdrec" )
  2470. {
  2471. print "";
  2472. print "<script type='text/javascript'>
  2473. function validate(form)
  2474. {
  2475. error=\"\";
  2476. if ( form.pwduname.value == \"\" && form.pwdemail.value == \"\")
  2477. {
  2478. alert('".$main->edit_array( $text['pwdrecoveryerror1'])."');
  2479. return;
  2480. }
  2481. else
  2482. {
  2483. form.submit();
  2484. }
  2485. }
  2486. </script>";
  2487. print "<span class=\"headline\"><b>$text[pwdrecovery] (1/2)</b></span><br /><br />";
  2488. print "$text[pwdrecoverytext1]";
  2489. print "<form enctype='multipart/form-data' action='?page=pwdrec2' method='post'><p><input type='hidden' name='rid' value='$requestid' />\n";
  2490. print "<table summary='pwd recovery'>\n";
  2491. print "<tr><td>$text[username]</td><td><input name='pwduname' type='text' id='pwduname'/></td></tr>\n";
  2492. print "<tr><td>$text[email]</td><td><input name='pwdemail' type='text' id='pwdemail'/></td></tr>\n";
  2493. print "<tr><td colspan='2'><input type='button' value='$text[pwdrecoverysend]' id='adduser' onclick=\"validate(this.form)\" class='button'/> <input type='reset' value='$text[reset]' class='button'/></td></tr>\n";
  2494. print "</table>\n";
  2495. print "</form>";
  2496. }
  2497. //}}}
  2498. //{{{ Bottom page
  2499. print "</td>\n";
  2500. if ($page!="splash")
  2501. {
  2502. if ( $rightcolumn == "true" and $role >= $rightcolumnaccess )
  2503. {
  2504. print "<td valign='top' class='menusmall' rowspan='2'>\n";
  2505. $latestnews=$main->getlatestnews($role,$nrlatest);
  2506. print "<b>$text[latestnews]</b><br />";
  2507. foreach( $latestnews->records as $lnews )
  2508. {
  2509. $date=date("y-m-d\&\\n\b\s\p\;H:i:s",$lnews['date']);
  2510. if ($lnews['headline'] == "")
  2511. {
  2512. $lnews['headline']="...";
  2513. }
  2514. print "<a href='?page=viewnews&amp;id=$lnews[id]'>$lnews[headline]</a><br />($date)<br />\n";
  2515. }
  2516. $latestcomments=$main->getlatestcomments($role,$nrlatest);
  2517. print "<br /><b>$text[latestcomments]</b><br />";
  2518. foreach( $latestcomments->records as $lcomment )
  2519. {
  2520. $date=date("y-m-d\&\\n\b\s\p\;H:i:s",$lcomment['date']);
  2521. if ($lcomment['headline'] == "")
  2522. {
  2523. $lcomment['headline']="...";
  2524. }
  2525. print "<a href='?page=viewnews&amp;id=$lcomment[id]'>$lcomment[headline]</a><br />";
  2526. if ( $lcomment['from'] == 0 and $lcomment['anonname'] != "" )
  2527. {
  2528. print "$lcomment[anonname]<br />";
  2529. }
  2530. elseif ( $lcomment['name'] != "" )
  2531. {
  2532. print "$lcomment[name]<br />";
  2533. }
  2534. print "($date)<br />\n";
  2535. }
  2536. $latestguestbook=$main->getlatestguestbook($role,$nrlatest);
  2537. print "<br /><b>$text[latestguestbook]</b><br />";
  2538. foreach( $latestguestbook->records as $lgbook )
  2539. {
  2540. $date=date("y-m-d\&\\n\b\s\p\;H:i:s",$lgbook['date']);
  2541. if ($lgbook['headline'] == "")
  2542. {
  2543. $lgbook['headline']="...";
  2544. }
  2545. print "<a href='?page=guestbook'>$lgbook[headline]</a><br />";
  2546. if ( $lgbook['from'] == 0 and $lgbook['anonname'] != "" )
  2547. {
  2548. print "$lgbook[anonname]<br />";
  2549. }
  2550. elseif ( $lgbook['name'] != "" )
  2551. {
  2552. print "$lgbook[name]<br />";
  2553. }
  2554. print "($date)<br />\n";
  2555. }
  2556. print "</td>";
  2557. }
  2558. print "</tr>\n";
  2559. print "<tr><td class='menusmallbottom'>$text[menusistersites]<br />";
  2560. $spacer="";
  2561. foreach ($sistersites as $sistersite)
  2562. {
  2563. print "$spacer<a href='http://$sistersite' onclick=\"window.open(this.href);return false;\">$sistersite</a>&nbsp;";
  2564. $spacer="<br />";
  2565. }
  2566. if ( isset( $extrasiteinfo ) and $extrasiteinfo != "" )
  2567. {
  2568. print "<br /><br />$extrasiteinfo<br />";
  2569. }
  2570. if ( ($enablecounter == "true" and $showcounter == "true") or ($enablecounter == "true" and $role >= 3 ))
  2571. {
  2572. print "<br /><br />$text[counter] $count";
  2573. }
  2574. print "</td>";
  2575. print "</tr></table>\n";
  2576. print "</td>";
  2577. }
  2578. print "<td class='rs'></td></tr><tr><td class='bls'></td><td class='bs'></td><td class='brs'></td></tr></table>\n";
  2579. if ($page!="splash")
  2580. {
  2581. #stop timer:
  2582. $etimer = explode( ' ', microtime() );
  2583. $etimer = $etimer[1] + $etimer[0];
  2584. #print generation time:
  2585. print "<table class='tpns' summary='vendor'><tr>";
  2586. print "<td class='tpns'><br /><a class='tpns' href=\"http://validator.w3.org/check?uri=referer\" onclick=\"window.open(this.href);return false;\"><img src=\"images/xhtml11.png\" alt=\"Valid XHTML 1.1\"/></a>";
  2587. if ( $enablerss == "true" )
  2588. {
  2589. print "<br /><a class='tpns' href=\"http://jigsaw.w3.org/css-validator/check/referer\" onclick=\"window.open(this.href);return false;\"><img src=\"images/css.png\" alt=\"Valid CSS!\" /></a>";
  2590. }
  2591. print "</td><td class='tpns'>";
  2592. print "$text[webmaster] <a href='mailto:$adminemail' class='tpns'>$adminemail</a><br />";
  2593. $lastupdate=$main->getlastupdate();
  2594. if ( $lastupdate != NULL )
  2595. {
  2596. $lastupdate=date("Y-m-d H:i:s",$lastupdate);
  2597. print "$text[lastupdate] $lastupdate<br />";
  2598. }
  2599. printf( "$text[pagegtime] %f $text[seconds]", ($etimer-$stimer) );
  2600. print "<br />$text[poweredby] <a class='tpns' href='http://tpns.sourceforge.net' onclick=\"window.open(this.href);return false;\">Tiger Php News System 1.0 beta ( build: 39 )</a>.<br />$text[licensetext] <a class='tpns' href='http://www.gnu.org/licenses/gpl.txt'>GPL</a></td>";
  2601. print "<td class='tpns'>";
  2602. if ( $enablerss == "true" )
  2603. {
  2604. print "<br /><a class='tpns' href=\"http://validator.w3.org/feed/check.cgi?url=http%3A//$_SERVER[HTTP_HOST]/rss.php\" onclick=\"window.open(this.href);return false;\"><img src=\"images/rss.png\" alt=\"[Valid RSS]\" /></a><br />
  2605. <a class='tpns' href=\"http://validator.w3.org/feed/check.cgi?url=http%3A//$_SERVER[HTTP_HOST]/atom.php\" onclick=\"window.open(this.href);return false;\"><img src=\"images/atom.png\" alt=\"[Valid Atom 1.0]\" /></a>";
  2606. }
  2607. else
  2608. {
  2609. print "<br /><a class='tpns' href=\"http://jigsaw.w3.org/css-validator/check/referer\" onclick=\"window.open(this.href);return false;\"><img src=\"images/css.png\" alt=\"Valid CSS!\" /></a>";
  2610. }
  2611. print "</td></tr></table>";
  2612. }
  2613. if ( $debug == "on" and !$main->isPublicIp($_SERVER['REMOTE_ADDR']))
  2614. {
  2615. //Debug
  2616. print "<pre>";
  2617. print $main->sqlstatments."\n";
  2618. print "page=$page\n";
  2619. print "subpage=$page\n";
  2620. if ( $isbot )
  2621. {
  2622. print "isbot=true\n";
  2623. }
  2624. else
  2625. {
  2626. print "isbot=false\n";
  2627. }
  2628. if ($havecookie)
  2629. {
  2630. print "havecookie=true\n";
  2631. }
  2632. else
  2633. {
  2634. print "havecookie=false\n";
  2635. }
  2636. print "requestid=$requestid\n";
  2637. print "oldrequestid=$oldrequestid\n";
  2638. print "userid=$userid\nrole=$role\n";
  2639. print "_SESSION\n";print_r($_SESSION);
  2640. print "_REQUEST\n";print_r($_REQUEST);
  2641. print "_COOKIE\n";print_r($_COOKIE);
  2642. print "_FILES\n";print_r($_FILES);
  2643. print "plugins\n";print_r($plugins);
  2644. print "siteheader\n";
  2645. print_r($siteheader);
  2646. #print "_POST\n";print_r($_POST);
  2647. #print "_GET\n";print_r($_GET);
  2648. print "_SERVER\n";print_r($_SERVER);
  2649. print ("text\n");print_r($text);
  2650. print "loaded extensions:\n";
  2651. print_r(get_loaded_extensions());
  2652. print "System information: ".php_uname()."\n";
  2653. print "PHP version: ".phpversion()."\n";
  2654. print "Upload max filesize $upload_max_filesize\n";
  2655. print "Upload max filesize for forms $form_upload_max_filesize\n";
  2656. print ip2long("192.168.0.0");print " = 192.168.0.0 \n";
  2657. print ip2long("172.16.0.0");print " = 172.16.0.0\n";
  2658. print ip2long("169.254.0.0");print " = 169.254.0.0\n";
  2659. print ip2long("10.0.0.0");print " = 10.0.0.0\n";
  2660. print ip2long("127.0.0.0");print " = 127.0.0.0\n";
  2661. ini_set("browscap", "php_browscap.ini");
  2662. $testbrowsercap=ini_get("browscap");
  2663. $browser = get_browser();
  2664. print_r($browser);
  2665. print "";
  2666. print "</pre>";
  2667. //End debug
  2668. }
  2669. if (!$usedbsessions){$main->closedb();}
  2670. print "</body></html>\n";
  2671. //}}}
  2672. ?>